Question: Below are the program specifications for different classes in a class inheritance hierarchy. Please create each class and test it with the test program below
Below are the program specifications for different classes in a class inheritance hierarchy. Please create each class and test it with the test program below so it gets the output posted below.



![DisplayStudents { public static void main (String []args) { Student[] studentList =](https://s3.amazonaws.com/si.experts.images/answers/2024/08/66d2d25f51079_44666d2d25e8e57d.jpg)
Test Program:
public class DisplayStudents {
public static void main (String []args)
{
Student[] studentList = new Student[4];
studentList[0] = new Undergraduate ("Smith, John", "123-456-789",
"Diploma", 4, true);
((Undergraduate) studentList[0]).setCoopStatus(true);
studentList[1] = new Undergraduate ("Green, Rob", "123-456-789",
"Degree", 5, true);
studentList[2] = new Graduate ("Mckay, Dave", "111-222-333",
"Degree", 5, true);
((Graduate)studentList[2]).setThesisTitle("Global Economy Analysis for the next decade");
studentList[3] = new PhdGraduate("Brown, Peter", "222-333-444",
"Degree", 5, false);
((PhdGraduate) studentList[3]).setThesisTitle("Distributed computing");
((PhdGraduate) studentList[3]).setComprehensiveExam(true);
for (int count=0; count
{
System.out.println (studentList[count]);
System.out.println();
}
}
}
Duw are the program specifications for different classes in a class inheritance hierarchy: public abstract class Student Constants FEE PER DEGREE COURSE 475.00 FEE PER DIPLOMA COURSE 425.00 Instant Variables String name // student name // student ID id program type / program type can be either "Diploma" or "Degree" int num_courses taking / number of courses currently enrolled boolean is_local_student // true local student; false foreign student Methods // Constructor public Student (String name, String id, String p_type, int numcourses, boolean islocal) l/tuition Fee0 function calculates and returns the tuition fee based on two factors: // 1. program type fee per degree course or diploma course times the number of courses currently taking 2. residence status public double tuition Fee0 //The toString0 method returns a string representation of a student object with all five - foreign students pay 4 times as much as local students pay // instant variables included public String toString 0 blic class Undergraduate It inherits the Student class with an additional constant and instant variable constant COOP_FEE 275.00 boolean is_coop_student true: is a co-op student; false: not a co-op student t uses super reference to initialize all the inherited instant variables, and then initializes is coop_student public Undergraduate(String name, String id, String p_type, int numcourses, boolean islocal) instant variable false in the constructor
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
