/**
* @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);
}
}
Andrew_70 0 Newbie Poster
rproffitt 2,662 "Nothing to see here." Moderator
Andrew_70 commented: I would, but he would like me to use the method way so I need those lines. +0
rproffitt 2,662 "Nothing to see here." Moderator
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.