Question
1. Create a Person Class with following attributes. a. ID - int b. name - String c. address - String 2. Generate get, set, constructor,
1. Create a Person Class with following attributes. a. ID - int b. name - String c. address - String
2. Generate get, set, constructor, and toString methods for Person Class.
3. Create Student Class that extends Person Class and has additional attributes. a. credits - int b. status String (Senior, Freshmen, etc..)
4. Generate get, set, constructor, and toString methods for Student Class. You should decide the status based on credits i.e credits < 30 :freshman, 30 70: Junior, >70 Senior
5. Create Faculty Class that extends Person Class and has additional attributes. a. department - String b. Office String c. Rank String
6. Generate get, set, constructor, and toString methods for Faculty Class.
7. Create Course Class with following attributes. a. classId int b. courseName - String c. facultyId int d. schedule String e. roomNumber - String
8. Generate get, set, constructor, and toString methods for Course Class.
9. Create Enrollment Class with following attributes. a. studentId int b. classId int
10. Generate get, set, constructor, and toString methods for Enrollment Class.
11. Create a driver program that will test all the classes as follows.
a. Create 5 instances of Person class by calling the constructor and set values as follows person1(1, John Smith, SAU) person2(2, David Austin, SAU) person3(3, Janet Johnson, SAU) person4(4, Star Fallen, SAU) person5(5, Andrew Henderson, SAU)
b. Create 3 instances of Student class by calling the constructor and set values. student1 (person1, 50, junior) student2(person3, 90, senior) student3(person5, 90, senior)
c. Create 2 instances Faculty class by calling the constructor and set values. faculty1 (person2, Math,M101, Assistant Professor) faculty2 (person4, Art, A101, Associate Professor)
d. Create 4 instances of Course class by calling the constructor and set values course1(1, art101, 4, MW9A, A121) course2(2, art102, 4, TH10A, A221) course3(3, math101, 2, MW9A, M121) course4(4, math102, 2, TTH11A, M122)
e. Create 6 instances of Enrollment class by calling the constructor and set values enroll1(1, 1) enroll2(1, 3) enroll3(2, 2) enroll4(2, 3) enroll5(3, 2) enroll6(3, 4)
f. Once you have all data initialized, print followings:
i. Print course names each faculty is teaching. Sample output: Faculty Name: David Austin Courses Teaching: math101, math 102
ii. Print the student count enrolled in each course Sample output: Course Name: art101 Total Student enrolled: 1
iii. Print the status of each student. Sample output: Student Name: John Smith Status: Junior
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