import java.util.Scanner;
public class { // BEGIN CLASS
public ()
{
}//END Constructor
public static void main(String[]args)
{//BEGIN main()
Scanner input = new Scanner (System.in);
String letterGrade = "";
String studentName = "";
String bannerID = "";
String course = "";
int grades;
String password = "";
double average = 0.0;
int attempt = 2;
int gradesAttempt;
int counterGradeAttempt = 1;
int gradesTotal = 0;
for (int counter =1; counter <=3; counter += 1)
{
System.out.printf("\nPlease enter the password: ");
password = input.nextLine();
if (!(password.equals("LipSmacker")))
{
if ( counter == 3)
{
System.out.printf("Sorry, invalid password! No more attempts left. Exiting program.");
counter = 5;
}
else
{
System.out.printf("\n\nInvalid password you have %d attempts left", attempt);
attempt = attempt - 1;
}
}
else
{
counter = 4;
System.out.printf("Enter your Banner ID: ");
bannerID = input.nextLine();
System.out.printf("Enter your Name: ");
studentName = input.nextLine();
System.out.printf("Enter your course: ");
course = input.nextLine();
System.out.printf("How many grades will be entered? ");
gradesAttempt = input.nextInt();
do
{
System.out.printf("\nPlease enter grade no %d: " ,counterGradeAttempt);
grades = input.nextInt();
gradesTotal += grades;
counterGradeAttempt = counterGradeAttempt + 1;
average = gradesTotal / gradesAttempt;
switch ((int)average )
{
case 10: letterGrade = "A";
break;
case 9: letterGrade = "A";
break;
case 8: letterGrade = "B";
break;
case 7: letterGrade = "C";
break;
case 6: letterGrade = "D";
break;
}
} while ( counterGradeAttempt <= gradesAttempt);
System.out.printf("STUDENTS CURRENT GRADE FOR %s" ,course);
System.out.printf("\n\nBanner ID: %s" ,bannerID);
System.out.printf("\nStudent Name: %s" ,studentName);
System.out.printf("\nAverage of grades: %.2f" ,average);
System.out.printf("\nLetter grade: %s " ,letterGrade);
}
}
System.exit(0);
}
} //END MAIN()
I cant get the letterGrade to print out