Answered step by step
Verified Expert Solution
Question
1 Approved Answer
solve using java language Q1. Create a University System which has the following classes: Class Course which has the following: - Instance variables: Course name,
solve using java language
Q1. Create a University System which has the following classes: 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. 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
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