Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need part D done in Java please. The below snips are my java files that I've already done but will ve needed for part

I need part D done in Java please. The below snips are my java files that I've already done but will ve needed for part D.

image text in transcribed

image text in transcribed

image text in transcribed

PART D: Now implement a class called University that has these private instance variables name -a String indicating the name of the University (e.g., "Purdue University Northwest") . courses - an ArrayListeCourse representing the list of courses offered by the university students an ArrayList representing the list of students registered at the university . Create the following public methods (see the testing code below for more on the method signatures) . get methods for all three instance variables . a single constructor that takes the name of the university a method called offerCourse(Course c) which adds the given course to the list of courses that the University offers a method called cancelCourse(Course c) which removes the given course from the list of courses that the University offers. The university must not allow a Course to be deleted that has students registered in it a method called enrollStudentInCourse(Student s, Course c) which enrolls the given student into the given course. The university must not allow a Student to enroll for a course that does not exist a method called withdrawStudentFromCourse(Student s, Course c) which withdraws the given student from the given course. The university must not allow a Student to withdraw from a course that he/she is not registered in. A toString0 method that returns a string representation of the university like this (where the numbers will vary according to the sizes of the two array lists): Purdue University Northwest: 26 Courses, 10 Students PART D: Now implement a class called University that has these private instance variables name -a String indicating the name of the University (e.g., "Purdue University Northwest") . courses - an ArrayListeCourse representing the list of courses offered by the university students an ArrayList representing the list of students registered at the university . Create the following public methods (see the testing code below for more on the method signatures) . get methods for all three instance variables . a single constructor that takes the name of the university a method called offerCourse(Course c) which adds the given course to the list of courses that the University offers a method called cancelCourse(Course c) which removes the given course from the list of courses that the University offers. The university must not allow a Course to be deleted that has students registered in it a method called enrollStudentInCourse(Student s, Course c) which enrolls the given student into the given course. The university must not allow a Student to enroll for a course that does not exist a method called withdrawStudentFromCourse(Student s, Course c) which withdraws the given student from the given course. The university must not allow a Student to withdraw from a course that he/she is not registered in. A toString0 method that returns a string representation of the university like this (where the numbers will vary according to the sizes of the two array lists): Purdue University Northwest: 26 Courses, 10 Students

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

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions