Question: The second programming project involves writing a program that produces a list of students who are eligible for membership in an honor society. This program
The second programming project involves writing a program that produces a list of students who are eligible for membership in an honor society. This program consists of four classes.
The java program must contain a main method. Standard programming practice locates the main method at the end of the program. The program class must be the same name as the java file name.
The first class is the Student class. It has three instance variables which include the student name, credit hours earned and quality points. At a minimum, it should have following methods:
A constructor that allows the student's name, credit hours and quality points to be initialized.
A method named gpa that returns the student's grade point average, which is computed as the quotient of the quality points and credit hours.
A method eligibleForHonorSociety that returns whether a student's gpa exceeds the threshold for honor society membership, which applies to all students.
A toString method that returns a string containing the student name and grade point average
A class static method setGpaThreshold that sets the minimum gpa threshold for honor society membership.
The Student class has two subclasses.
The first is Undergraduate. It has an additional instance variable that specifies the student's year: either a freshman, sophomore, junior or senior. At a minimum, it should have following methods:
A constructor that allows the student's name, credit hours, quality points and year to be initialized.
An overridden method eligibleForHonorSociety that applies the requirement that the student be either a junior or senior in addition to the requirement that applies to all students to be eligible for honor society membership.
An overridden toString method that returns a string containing the student's name, grade point average, and year. The second subclass is Graduate. It has an additional instance variable that reflects whether the student is pursuing a master's degree or doctorate at a minimum, it should have following methods:
A constructor that allows the student's name, credit hours, quality points and degree sought to be initialized.
An overridden method eligibleForHonorSociety that applies the requirement that the student be seeking a master's degree in addition to the requirement that applies to all students to be eligible for honor society membership.
An overridden toString method that returns a string containing the student's name, grade point average, and degree sought.
Finally, there should be a fourth class DataControl. It should read in student information from a text file named students.txt If the file does not exist, an error message is displayed, and the program should terminate. Each line of the text file will represent the information for one student. An example of how the text file should look is shown below:
Brown, William Junior name credit hours, quality points, year
Johnson, Mary Masters name credit hours, quality points, degree sought
Jones, Sally Sophomore name credit hours, quality points, year
For undergraduate students, the final value is the student's year. For graduate students, the final value is the degree the student is seeking. As the students are read in Student objects of the appropriate type are created, and they are stored in an array list of type Student. As the students are read in the total of all grade point averages should be accumulated so that an average gpa can be computed. You may assume that the file that the data in the file will be formatted correctly. The students.txt data file is generated by the programmer.
Once all the student data is read in the threshold for honor society membership should then be set to the midpoint of the average gpa and the highest possible gpa of by calling the setGpaThreshold method. The threshold should also be displayed on the console. Then a report should be displayed on the console that lists all students who are eligible for membership.
The program name should be CMSCPROJlast nameinitial
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
