Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can you solve it in java language?? Class Course which has the following: - Instance variables: Course name, Course no - Constructor that initializes the

can you solve it in java language??

image text in transcribedimage text in transcribedimage text in transcribed

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. - 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

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

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions