This discussion is archived
3 Replies Latest reply: Dec 10, 2012 12:46 PM by 896976 RSS

Change this code to accept the grades from the user..

896976 Newbie
Currently Being Moderated
how I will change this code
 
package regradesaverage;

public class ReGradesAverage {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
    int[] array = {87,68,94,100};
     int total = 0;

     for (int counter = 0; counter < array.length; counter++)
         total += array[counter];
     System.out.printf("Total sum of Grades : %d\n", total);
      System.out.printf("The Grade Average is: %d\n", total/array.length);
    }
}
to accept the grades from the user
I need to create a method called "average" that takes has an array of strings as a parameter and returns double.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points