Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Course.java - Write class Course that has a CourseName(String name), Students (String array to store the students name for the course, assume the maximum course
Course.java - Write class Course that has a CourseName(String name), Students (String array to store the students name for the course, assume the maximum course enrollment is 10 ), NumberOfStudents (Int number of students (default: 0 ), Time (time object that represents the course time, hint:Composition) and count ( as a static variable. The count is incremented every time course object is created) - Write the default constructor, a constructor that takes course name only, a constructor that takes full parameters, and Copy constructor. - Write the set and get methods for your attributes. - toString method which returns a String representation of the class. (hint:add Arrays.toString(myarray) to print whole array) in this format: Course \{course Name= CS175, numberOfStudents= 10 , Time = Time { hours =10, minutes =0, seconds =0}, students=[Norah, Sarah. Hind] - Create a method DropStudent which takes a student name as an argument and drops the student from the course (hint: delete student's name from the array, using equals O to find the name, and decreases NumberOfStudents). Time.java -Write class Time that has int hours, minutes, seconds. .Write the default constructor and a constructor that takes full parameters. - Write setter and getter methods for all instances. - toString method which returns a String representation of the class Course test.java write a demo program (Couse_Test) that tests the methods of your Course class: 1. Create two arrays (A1, A2) for students and fill them with data of your choice. Ex, four students in A1, two students to A2. 2. Create two Time objects (t1,t2) and fill them with time data. 3. Create two Course objects (course1, course2) and fill them with pervious data. Ex, set t1 for course 1 and set t2 for course2. 4. Print all the information after adding the students, and print the count. 5. Drop third student from coursel using her name, drop first student from course 2 using her name. 6. Create another two Course objects (course3, course4) with no arguments. 7. Print all the information after dropping the students, and print the count
Step 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