/* Chapter 5: Programming Assignment 7 Programmer: Date: Program Name: AveragingGradesTemplate */ import java.io.*; public class AveragingGradesTemplate { public static void main(String[] args) throws IOException { //Declaring variables BufferedReader dataIn = new BufferedReader(new InputStreamReader(System.in)); String grade, strSize; float average; int size; System.out.print("How many grades will you enter? "); strSize = dataIn.readLine(); size = Integer.parseInt(strSize); float grades[] = new float[size]; for (int i=1; i<size; i++) { //Get input from user System.out.print("Enter grade " + i + ": "); grade = dataIn.readLine(); grades[i] = Float.parseFloat(grade); } average = averageGrades(grades, size); //Write a for loop to display grades System.out.println(""); System.out.println("The average grade was "+average); } public static float averageGrades(float[] g, int s) { float total = 0; float a; // write a for loop to calculate the total ?????????????????????????????????? ?? ????????????????????????????????? ????????????????????????????????? a = total / s; return a; } }
I need to write a for loop for my calculations and I am lost.