3 Replies Latest reply: Dec 10, 2012 2:46 PM by 896976 RSS

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

    896976
      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.