Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Course Assignment Program 7 This assignment will be started in class but completed as a homework assignment Write a class XXX Course, (XXX is your
Course Assignment Program 7
This assignment will be started in class but completed as a homework assignment Write a class XXX Course, (XXX is your Kean Id) (12.5 points total) A course has a department code (e.g., CPS or MATH), a course number, and a room number. (1.5 points) Include a static variable used to assign the course number to each Course in the constructor. The value of the variable will start at 2000. (1 point) Write the accessors (getters), the mutators (setters) and two constructors for the class. One of the constructors should be the no-args constructor. o o o Accessors (getters) (2 points) Mutators (setters) (2 points) .Constructors (4 points) o Also write a toString) method that returns all of the instance variables strung together appropriately (e.g., "Dept: CPS; CourseNumber: 2000; Room 208") (2 points) Write a second class, XXX CourseTester (XXX is your Kean Id) ,which will have a main method. (12.5 points total) Create an Array of Course objects that can hold 3 elements. (1.5 points) Using a loop: (7 points) o o Ask the user for the department and room number for 3 courses TIP: Use next() instead of nextLine) Create course objects Store the objects in the Array - At the end, traverse the array of courses and print each course on a separate line. (4 points) o Sample output Enter Dept CPS Enter room number 208 Enter Dept CPS Enter room number 220 Enter Dept CPS Enter room number 204 Printing the courses Dept: CPS; CourseNumber: 2000; Room 208 Dept: CPS; CourseNumber: 2001; Room 220 Dept: CPS; CourseNumber: 2002; Room 204Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started