Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Design class Student stored in source code file Student.java. Provide data members for string student identification number ( ex . 1 0 0 0
Design class Student stored in source code file Student.java. Provide data members for string
student identification number ex student name ex "Mary Smith" student major ex
"CIS" and number of credit hours ex Provide default and parameterized constructor, accessors,
mutators, and toString methods. Include a boolean canGraduate method which returns true if the
student has at least credit hours, else false.
The main application uses an array of Student. Input file
graduates.txt records the number of students in the first line
followed by lines of student data in commaseparated fashion.
a Read the data from the file into the array. Use exception
handling with a trycatch block to end the program on a file IO
error.
b Use an interactive loop to ask the user to enter student identifications and number of credit hours
awarded during the summer. Search for the student identification in the array and update the credit
hours. Report an error message if the identification is not found. Use exception handling with a try
catch block to report an entry error on the integer number of summer credit hours. Hint: Read the credit
hours as a string and use Integer.ParseInt method to convert to an integer. Catch the
NumberFormatException that arises if Integer.ParseInt fails. This loop uses "quit" as the sentinel
value to stop. See sample output.
c Produce a neatly formatted chart showing graduation status. See sample output.
The following static method in the main application is required. Other methods may be added as
desired.
return the index of the Student with identification or if not found
public static int searchID Student students, String identification
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started