Answered step by step
Verified Expert Solution
Link Copied!

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
image text in transcribed
image text in transcribed
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

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_2

Step: 3

blur-text-image_3

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

Larry Ellison Database Genius Of Oracle

Authors: Craig Peters

1st Edition

0766019748, 978-0766019744

More Books

Students also viewed these Databases questions

Question

9. Understand the phenomenon of code switching and interlanguage.

Answered: 1 week ago

Question

3. Are our bosses always right? If not, what should we do?

Answered: 1 week ago

Question

2. What, according to Sergey, was strange at this meeting?

Answered: 1 week ago