/**
 * @param args the command line arguments
 */
public double averagegrades(double total, double average) {
average = total/5;
return average;

}


public static void main(String[] args) {
Scanner input = new Scanner(System.in);
double[] grades = new double[5];
double total = 0;
double average = 0;
    for(int i=0; i<5; i++){
        System.out.println("Enter Number: ");
        grades[i] = input.nextDouble();
        total = total + grades[i];

    }
System.out.println("The average is"+average);
}
}

It appears you never computed the average. Why not simplify this code.

  1. Delete lines 1 to 10.
  2. Delete line 15
  3. Replace line 22 with System.out.println("The average is"+(total/5));
commented: I would, but he would like me to use the method way so I need those lines. +0

Sorry but I assumed this was a problem to be solved and not some homework/exercise. Everyone must share such or the discussion may result in a dead end.

The problem still is, your code didn't compute the average. Since it's your homework I can't complete this for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.