Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: use array of scores to calculate an average

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Location
    kentucky
    Posts
    1
    My Mood
    Mellow
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question use array of scores to calculate an average

    need help with a project I am working on to help a former teacher....

    she needs to use java to make a program using array of scores to calculate a average:
    requirements: function must be called scores ; must have at least 6 scores ; will need a variable to hold the sum of the scores ; have a loop that will go through the array and add up the total of all scores in array ; then calculate the average and only display that to the screen

    does anyone have any ideas? i have never done a program like this but am wanting to help her if I can.
    This is what I have so far...no idea if its anyway correct

    <body>

    <p> Average: <span id="output"></span></p>

    <script type="text/javascript">
    var scores [];
    function addScores() {
    'use strict' ;
    var scores = document.getElementById('scores');
    var output = document.getElementById('output').value=scores[i];




    // End of scores() function.

    window.onload = scores;
    </script>


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: use array of scores to calculate an average

    Wrong forum. This one is for java.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Print Student average, high, and low grades through array?
    By MLeclerc182 in forum Object Oriented Programming
    Replies: 2
    Last Post: May 10th, 2012, 06:12 AM
  2. Using recursion to calculate a path through an array
    By jpetticrew in forum Algorithms & Recursion
    Replies: 2
    Last Post: September 20th, 2011, 05:21 PM
  3. Calculating average of an array
    By Vika in forum What's Wrong With My Code?
    Replies: 7
    Last Post: March 29th, 2011, 08:06 AM
  4. Average program with array and loop and JOptionPane.
    By jeremykatz in forum AWT / Java Swing
    Replies: 6
    Last Post: October 25th, 2009, 02:33 PM