Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 1: The Registration System The Registration system allows students to enroll in courses. It contains exactly 3 classes: Student Course, Registration The Registration class

image text in transcribed
image text in transcribed
Assignment 1: The Registration System The Registration system allows students to enroll in courses. It contains exactly 3 classes: Student Course, Registration The Registration class is provided. Do not make any changes to this file. Write the Student and Course classes as specified below. Upload just these two files to Blackboard, do not zip them. When you correctly write, compile and run all three of these files, the output must be exactly as shown below: Course: Data Structures, taught by Professor Bleichman, has 2 student(s) enrolled: Student: Alexandra Perez, ID: A12345, is enrolled in 1 course(s) Student Bopha Chan, ID: A67890, is enrolled in 2 course(s). Course: Calculus I, taught by Professor Arambel, has 1 student(s) enrolled: Student: Bopha Chan, ID: A67890, is enrolled in 2 course(s). (15 pts) ta Student should contain the following: Private instance variables that store the student's name and is for a Student, plus an array of Course objects. Assume that a student can take at most 5 Courses A constructor that takes 2 parameters that correspond to the first 2 instance variables (not the array). The addCourse method, which will take a Course as its only parameter, and will add the course to the array of Courses for this Student Keep track of the number of Courses that a Student is enrolled in The toString method which should return a string containing the Student info, including the number of Courses taken, as shown above. There should be no printing code in Student (20 pts) Course should contain the following: Private instance variables that store the course name and the professor for a course, plus an array of Student objects. Assume that a Course may have at most 18 students. A constructor that takes 2 parameters that correspond to the first 2 instance variables (not the array). The addStudent method, which will take a Student as its only parameter . It will add the Student to the array of Students for this Course It will call that Student's addCoursel) method to add this Course to that Student. Keep track of the number of Students enrolled in a Course A toString method which should return a string containing the Course info, including the number of Students enrolled, as well as each of its Student's info, by calling the toString method of each Student, as shown above (Yes, this is a long, multiline string!) There should be no printing code in Course (15 pts) The files should each compile with no errors. The program should be designed according to this specification, un correctly, and not cause any Run Time Exceptions. The program output should be exactly as specified above. Each Java file should have proper Code Documentation, including a completed Code Header. Assignments will not be accepted without this part. package Registration; * @author BLEICHMANM */ 1/ Program: Registration // Written by: Margie Bleichman 1/ Program Description: The program will implement a Registration system that uses Student and Course classes. // File name: Registration.java (This is the client or tester file.) // File description: This is a tester for the Student and Course classes that the student will write. // Files in this program: // To be written by student: Course.java, Student.java // Provided by professor: Registration.java // Note: DO NOT MODIFY the provided files // Revision History: // Date: By: Action: mb 1/ 01/21/13 mb Created 1/ 01/23/22 updated public class Registration { public static void main(String[] args) { Student sl - new Student ("Alejandra Perez", "11111"); Student s2 = new Student ("Bopha Chan", "22222"); Course ci = new Course ("Data Structures", "Bleichman"); Course c2 - new Course ("Calculus I", "Arambel"); tryk cl.addStudent (sl); cl.addStudent (s2); c2.addStudent (s2); System.out.println(cl); System.out.println(c2); } catch (Exception e) (System.out.println("Error: "+ e.getMessage()); } }

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_2

Step: 3

blur-text-image_step3

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

More Books

Students also viewed these Databases questions

Question

Increasing investment time and money in employee training.

Answered: 1 week ago