Question: please write Java code Class Course which has the following: - Instance variables: Course name, Course no - Constructor that initializes the instance variables -

please write Java code

please write Java code Class Course which has the following: - Instance

variables: Course name, Course no - Constructor that initializes the instance variables

Class Course which has the following: - Instance variables: Course name, Course no - Constructor that initializes the instance variables - Setters and getters - toString(): that returns the course info Class Person which has the following: - Instance variables: name and address - Constructor that initializes the instance variables - Setters and getters Class Student that extends class Person and has the following: - Instance variables: numOfCourses (int), array of Courses with a size of 100 - Constructor that takes the name and address as arguments: initializes the instance variables (name and address), set numOfCourses to 0 and create the array of Courses. - addCourse(): which add a course to the Student courses array, and it should increase the number of courses by 1 . Make sure you don't exceed the array size limit when you add a course. - toString(): that prints the student name along with all the courses names the students has taken. Class Faculty that extends class Person and has the following: - Instance variables: array of Courses with a size of 100 - Constructor that takes the name and address as arguments: initializes the instance variables (name and address), and create the array of Courses. - addCourse(): adds a course to the Faculty courses array if the course does not exist, return false if the course already exist. Make sure you don't exceed the array size limit when you add a course. - removeCourse(courseName): removes the course from the array, returns false if the course does not exist - toString(): that prints the Faculty name along with all the courses names. Class Test: - Create one student and one Faculty - Add 3 courses to the student - Add 3 courses to the Faculty, add a fourth course which already exist. - Print the student info and the faculty info using toString() - Remove a course from the Faculty - Print the faculty info. Sample output: The course already exists Maryam has taken: Java C++ Network Dr. Noor has taught: Java C++ Network Dr. Noor has taught: Java C++

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!