Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA - How do you code this problem? Other classes can be created PROBLEM 3: Course Correction [40 points] Now that we have that sorted,

JAVA - How do you code this problem? Other classes can be created image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image 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 +getCampus (): String +getCourseID(): int +getCourseCode (): String +getNumberStudents(): int +get Students(): Student[] (Returns array of registered students) +isInCourseAlready (student: Student): boolean +isSpace LeftInCourse(): 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. +getCampus (): String Returns the name of the campus (based on the room) in which the course is located. +get CourseID(): int Returns the ID of the course (e.g. the CRN for your courses) +getCourseCode(): 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. tisInCourseAlready (student: Student): boolean Returns true if student is already registered for the course, false otherwise. tisSpace LeftInCourse(): 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

DB2 11 The Database For Big Data And Analytics

Authors: Cristian Molaro, Surekha Parekh, Terry Purcell, Julian Stuhler

1st Edition

1583473858, 978-1583473856

More Books

Students also viewed these Databases questions