Question: Problem 7 (12 points): Based on the following description, write a Java class. The courses in Metro state are represented by Course objects. Each Course
Problem 7 (12 points): Based on the following description, write a Java class. The courses in Metro state are represented by Course objects. Each Course has a name of the ourse, the number of students registered for the course, and an array of string that contains the name of each student (you can set the array size to 100). Thus, the class Course should contain three instance variables: String courseName, String[] students new String[100], and int numberOfStudents. A Course is created by passing a course name as shown below. When a new Course object is created, the number of students is initialized to 0. In this case, the course name is "ICS 141-01 Programming >Course es1- new Course("ICS 141-01 Programming with Object"); The class must be designed in such a way that it returns a reasonable re Course object as the following example shows (the registered number is just one of possible values). presentation of the >System.out.println(es1); Course ICS 141-01 Programming with Object. Number of student registered 10. The class must have a method named addStudent, which is called when a student registers the course. The method accepts student name as a parameter. The number of students registered must then be incremented by 1. The method does not return anything. The following code registers a new student named Michael to the newly created course cs1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
