Question: Java OOP - inheritance- Help please Only ARRAY and MATH are allowed. no other libraries should be use //ProfessorOld works 20 weeks each year //professorYoung

Java OOP - inheritance- Help please

Only ARRAY and MATH are allowed. no other libraries should be use

//ProfessorOld works 20 weeks each year

//professorYoung works 40 weeks each year

so the two subclasses to fit the type of professor added in course.java

//addProfessors methods are to add professors into a professor array type. To store all the professors and their salary of a specific course with their salary before a new course is created.

//the two subclasses are to calculate the yearly salaries, name and keep it as a professor type, to add to the professor type Array

Please implement the professorOld.java, professorYoung.java and professor.java , and the two methods addProfessorOld and addProfessorYoung in course.java,

------------------------------------------------------------------------------------------------------------------------

//these are the datas to pass in

public class TestData {

public static Course Engl() { Course course= course.makeNewCourse("Engl", 6);//make a new course name Engl with maximum 6 professors then add professor name to an array in course.java course.addProfessorOld("Hong Lui", 10000); course.addProfessorOld("Abby Ehm", 11000); course.addProfessorOld("Zec Xon", 12000); return course; }

public static Player Hist() { Course course= college.makeNewCourse("Hist", 10); course.addProfessorOld("Abby bbb", 15000); course.addProfessorOld("Ader ccc", 50000); course.addProfessorYoung("Ioi Iui", 20000); course.addProfessorYoung("Ikia Kkk", 30000); return course; }

---------------------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------

package col;

//create and return course object

public class College {

public static Course makeNewCourse(String courseName, int maxProfessor) { Course course = new Course(courseName, maxProfessor); return course; } }

-----------------------------------------------------------------------------------------------------------------------------------

package col;

public class Course { private Professor[] professors; public Course(String courseName int maxProfessor) { professors = new Professor[maxProfessors]; } //return false if a professor already existed in the Professor array

//else add the professor to the Professor Array public boolean addProfessorOld(String name, double salary) {

}

//return false if a professor already existed in the Professor array

//else add the professor to the Professor Array

public boolean addProfessorYoung(String name, double salary) {

}

--------------------------------------------------------------------------------------------------------------

package col;

//storing a professor in array type of professor

public class Professor {

}

----------------------------------------------------------------------------------------------------

package col;

//creating a type of professorOld

public class ProfessorOld extends Professor {

}

-------------------------------------------------------------------------------------------------------------------------------------------

package col;

//creating a type of professorYoung

public class ProfessorYoung extends Professor {

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!