Hey guys im writing a program that determines your grade here is the code so far.Scanner s = new Scanner(System.in); String [ ] name = new String [3]; int [ ] score = new int [10]; char [ ] grade = new char [10]; int i =0; do { System.out.print("Enter student's Last name: "); name[i] = s.nextLine(); System.out.print("Enter student's score: "); score[i] = Integer.parseInt(s.nextLine()); System.out.print("Enter student's score: "); score[i] = Integer.parseInt(s.nextLine()); System.out.print("Enter student's score: "); score[i] = Integer.parseInt(s.nextLine()); System.out.print("Enter Final Exam score: "); score[i] = Integer.parseInt(s.nextLine()); if (score[i] != -1) i++; } while (score[i] != -1 && i<10); for (int j=0; j<i; j++) { if (score[j] >= 90) grade[j] = 'A'; else if (score[j] >= 80) grade[j] = 'B'; else if (score[j] >= 70) grade[j] = 'C'; else if (score[j] >= 60) grade[j] = 'D'; else grade[j] = 'F'; } // end for System.out.println("\nName\t\tScore\t\tGrade"); for (int j=0; j<i; j++) System.out.println(name[j]+"\t\t"+score[j]+"\t\t"+grade[j]); } // end main } // end class
instead of having the user put in -1 to end the inputs of the grades I'm trying to figure out how to just have 2 students put in there grades and be done with it.
Thanks for your help