#Why is my porgram getting an illegal start of an expression error?
1 messages · Page 1 of 1 (latest)
you havve an extra public static void main inside your determineGrade method
your next issue is that you don't return a string from determineGrade in all casaes
import java.util.Scanner;
//Created my Main class
public class TestAverageGrade {
//Created my first method for the user to store test scores in variables
static int calcAverage(int A, int B, int C, int D, int E) {
//The value is going to return all five of the test scores divded by 5.
return (A + B + C + D + E) / 5;
}
public static void main(String[] args) {
//Created a Scanner for user input for score
Scanner intInput = new Scanner(System.in);
int i = 1;
String scoreInput = "What is the score of test %d \n";
System.out.printf(scoreInput, (i++));
int A = intInput.nextInt();
System.out.printf(scoreInput, (i++));
int B = intInput.nextInt();
System.out.printf(scoreInput, (i++));
int C = intInput.nextInt();
System.out.printf(scoreInput, (i++));
int D = intInput.nextInt();
System.out.printf(scoreInput, (i++));
int E = intInput.nextInt();
//System.out.println(calcAverage(A, B, C, D, E));
}
//Creating a new method for Nuumber to Letter grade conversion.
static String determineGrade(int A, int B, int C, int D, int E) {
//Creating a number to letter grade conversion
if (A >= 90) {
return "Letter grade is an";
} else {
System.out.println("Good job");
}
}
}
fix that and it should at least compile
thank you!