Question: Hello! My code works for the most part, but my catch statement isn't printing. It just goes back to the main menu. How do I
Hello! My code works for the most part, but my catch statement isn't printing. It just goes back to the main menu. How do I fix this? Java only please and thank you!
System.out.printlnPlease enter in the amount of students you would like to enroll: ;
Scanner sc new ScannerSystemin;
int newEnrollment scnextInt;
scnextLine;
for int i ; i newEnrollment; i
System.out.printlnStudenti information:";
System.out.printlnFirst Name: ;
String first scnextLine;
System.out.printlnLast Name: ;
String last scnextLine;
System.out.printlnAge: ;
try
int age scnextInt;
ifage && age
StudentInfo newStudent new StudentInfofirst last, age;
student.addnewStudent;
System.out.println;
displayStudentInfostudent;
System.out.println;
catchNumberFormatException e
System.out.printlnStudent does not meet age requirements";
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
