
Hi, I really appreciate the help I have gotten,I have 3 more problems to go by Monday.I will need help with all three. I hope someone is willing to help. So far I have found this web site to be the best for help, other sites I have tried only look down at you and give you attitude.I got sick mid way through this course and have found it impossible to catch up with all my other classes and the semester closes Monday.In this problem I have to write an application that displays a series of at least 10 student ID numbers (that are to be stored in an array) and asks the user to enter a test letter grade for the student. Create an Exception class named GradeException that contains a static public array of valid letter grades('A''B','C','D','F',and 'I'), which you can use to determine whether a grade entered from the application is valid. In the application, throw a Grade Exception if the user does not enter a valid letter grade. Catch the GradeException, and then display an appropriate message.In addition, store an 'I' for (incomplete)for any student whom an exception is caught. At the end of the application, display all the student IDs and grades. Save them as GradeException.java and TestGrade.java.I have got the code for 1 student, but I'm not sure about array and the rest. Here is the code I have:
public class GradeException extends Exception
{
public GradeException(String s)
{
super(s);
}
}
public class TestGrade
{
public static void main(String args[]) throws Exception
{
int id;
int grade;
String grades = new String();
try{
id = 123;
System.out.println("Student id number: " + id);
System.out.println("Enter the grade for the above student id number.");
grade = (char)System.in.read();
grades = String.valueOf((char)grade);
if(grade != 'A' && grade != 'B' && grade != 'C' &&
grade != 'D' && grade != 'F')
throw (new GradeException(grades));
System.out.println("The id and grade for this student is:");
System.out.println(" " + id + " " + (char)grade);
}
catch(GradeException e)
{
System.out.println("Invalid grade - " + e.getMessage());
}
}
}