Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Apr 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to make a java program that gets average test scores?

    I need help making a java program that will allow me to input 10 test grades into an array using a dialog box in one method. Then in a different method it needs to display the grades and calculate the average, highest, and lowest grade. I have no idea where to start and need a lot of help please.

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,636
    Thanks
    6
    Thanked 1,003 Times in 976 Posts
    Are you talking about Java or JavaScript?

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,919
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Please see forum rule #1.5.

    This forum is not a free coding service. As a general rule, the people helping out in this forum don't write code for others (especially code that appears to be for homework), but try to help with fixing code that doesn't work. You may perhaps get someone to write this script for you, but you'll be far more likely to get help if you have made a substantial effort and written some code yourself. Then someone here will almost certainly help you correct/improve your work.

    Be aware that Java and Javascript are entirely different programming languages, in spite of the confusingly similar names. Rather like Austria and Australia! This is the JavaScript forum. If you really mean Java, you should ask a mod to move this thread to the right forum.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #4
    New Coder
    Join Date
    Mar 2011
    Location
    England
    Posts
    29
    Thanks
    0
    Thanked 5 Times in 5 Posts
    i think your a little confused on some terminology but lets assume your talking Javascript.
    firstly you need to gather some user input, read up on the prompt and confirm methods. you can use the .split() method to return an array from your user input. Next read up on array.sort() - then using array.length() you can return the 0 position and the end position once your array has been sorted numerically. You can work out the average by using a forloop to loop through your array and add up each index's value then divide by the length of the array. This is just how i'd go about solving this, there may be better ways.

    Hope this gives you a rough idea of how to get solve your problem. Have a go at it and i'm sure everyone would be glad help you improve it.

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,189
    Thanks
    75
    Thanked 4,341 Times in 4,307 Posts
    I think he really is talking about Java, since he mentions "dialog box", which is a common Java term but not much used in JavaScript.

    In which case not only is he not following the forum rules, he is also posting in the wrong forum.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •