Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, I need help with my Java exercise. Thank you in advance. PROBLEM 3: Course Correction [40 points] Now that we have that sorted, we

Hello, I need help with my Java exercise. Thank you in advance.

image text in transcribedimage text in transcribedimage text in transcribed

PROBLEM 3: Course Correction [40 points] Now that we have that sorted, we are ready to connect all the dots. You will complete the Course class in this problem. All the information you should need can be found within the descriptions and UML diagram below. The Course class The Course class makes use of all of the other classes that you have made so far. In order to start this problem, you must have completed the first two problems successfully. You may then copy those files over here. Course -courseID: int -courseCode: String -courseName: String -courseCapacity: int -numberStudents: int -room: Room -students: Student[] -waitListCount: int +Course (ID: int, code: String, name: String, room: Room) +getBuildingName(): String +get Campus (): String +get CourseID(): int +get CourseCode (): String +get Number Students(): int +get Students(): Student[] (Returns array of registered students) +isInCourseAlready (student: Student): boolean +isSpaceLeftInCourse(): boolean +register Student (student: Student): int +toString(): String Description of methods for the Course class: +Course (ID: int, code: String, name: String, room: Room) Constructs a Course object with course ID, course name and room specified. Number of students and wait list count is cleared. Course capacity is set to the capacity of the room specified. Student array is set initialized to fit capacity. +getBuildingName(): String Returns the name of the building (based on the room) in which the course is located. +get Campus (): String Returns the name of the campus (based on the room) in which the course is located. +getCourseID(): int Returns the ID of the course (e.g. the CRN for your courses) +get Course Code (): String Returns the course code (e.g. "CSCI 1110") +get Number Students(): int Returns the number of students registered for the course. +get Students(): Student[] Returns an array of Students that are registered in the course. Note that this is a subarray of the students array. +isInCourseAlready (student: Student): boolean Returns true if student is already registered for the course, false otherwise. +isSpaceLeftInCourse(): boolean Returns true if there is space left in the course (e.g. number of students is less than the course capacity). +registerStudent (student: Student): int Registers (adds) a Student to the class if possible. If the student is already in the course, the student is not added. If number of students in class is greater than the capacity of the room/course, the student is not added and the wait list count for the course by 1 (student's number on wait list). Returns O if student is added to course, -1 if previously registered, or the number on the wait list if there was no space in the course and they were added to the wait list +toString(): String Overrides the existing string representation of the object. Return the following value: value = "COURSE" + course-ID +": " + course-code +"-" + course-name + " " + room.toString() + " " + "Current:" + number-students "/" + course-capacity + " " + "Wait list count:" + wait-list-count

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

Seven NoSQL Databases In A Week Get Up And Running With The Fundamentals And Functionalities Of Seven Of The Most Popular NoSQL Databases

Authors: Aaron Ploetz ,Devram Kandhare ,Sudarshan Kadambi ,Xun Wu

1st Edition

1787288862, 978-1787288867

More Books

Students also viewed these Databases questions