Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java A constructor, Person(String name, String address) Getters and Setters for name and address, respectively. String getName() void setName (String name) String getAddress() void setAddress(string

java image text in transcribed
A constructor, Person(String name, String address) Getters and Setters for name and address, respectively. String getName() void setName (String name) String getAddress() void setAddress(string address) In addition, you will also create two subclasses of Person called student.java and Professor.java. The Student class should contain: Unique Instance Variables: String[] courses. A new student's course array should have all entries as "none". Char[] grades. A new student's grades array should have all entries as 'A' A student can take at most 6 courses, therefore both courses and grades should be of length 6. A constructor, Student(string name, String address). You should initialize courses and grades here. Getters for courses and grades A unique method, addCourse(String course). This method will add the course to the student's courses array so long as: They are not currently enrolled in the course. They are not already taking 6 courses, i.e. one or more entries in their courses array is "none". New courses should be added to the leftmost available slot in the courses array. This method returns true if they successfully add the course, and false otherwise The Professor class should contain: Unique Instance Variables double salary. A professor's salary is dependent on their rank, which can be either "Assistant or Professor". Those with the rank "Assistant" have a salary of 70,000. Those with the rank of "Professor" have a salary of 100,000. String course String rank. Changes to a professor's rank should result in the corresponding salary, regardless of what their salary was previously. If an "Assistant" has a salary of 95,000 and becomes a "Professor", then their new salary is 100,000. A constructor Professor(string name, String address, String course, String rank) Getters and Setters for salary, course and rank Finally, we will implement a class Course.java to wrap the previous classes together. This will act as a college course, with an associated name, Professor and Students array, as well as a way to keep track of how many students have enrolled in the course. Course java is not an extension of Person The Course class should contain: Unique instance variables: Professor professor Student[] students. The students array must be of size 100. String courseName int numEnrolled A constructor course(Professor professor, String courseName) Getters for the above instance variables A unique method, boolean enroll(Student s). Enrolls the student in the course, given The course is not full The student successfully adds the course This method returns true if they are successfully enrolled, and returns false otherwise

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

2. List the advantages of listening well

Answered: 1 week ago

Question

1. Which position would you take?

Answered: 1 week ago