Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

how do you code this in JAVA? yes, other things can be added on top PROBLEM 3: Course Correction [40 points] Now that we have

how do you code this in JAVA?
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
yes, other things can be added on top
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 +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). 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. +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 with AI-Powered 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

Students also viewed these Databases questions