$30
CSC 3020
Java Programming
Lab 03
25 points
Assignment Objectives:
■■ To demonstrate how to modify classes and create objects.
■■ To process and manipulate an array of strings.
All labs must be submitted by the Canvas. No email or hard copy is accepted. You must follow the following format:
a. Submit your file to the Canvas. You must submit your file on time; otherwise, you will receive zero.
b. You can upload your file as many times as you like. Only the last attempt counts because the last file you uploaded is the only file your instructor will see.
c. There will be several modules on the Canvas. You need to upload your file using the correct module on the Canvas.
d. Name the lab file: Lab (labt number)
e. To upload your file(s):
• In Course Navigation, click the ASSIGNMENTS module.
• Click the title of the assignment.
• Click the Submit Assignment button.
• Add File. ...
• Submit Assignment. ...
• View Submission.
It is your responsibility to make sure that the file is uploaded correctly. If you uploaded a wrong file, you receive zero; files will not be accepted after due date even if you have a prove that the file is created before the due date.
Make sure you review the Cheating & Plagiarism policy on Canvas.
Solution to this assignment will not be posted on Canvas; however, any question can be discussed in the class upon request of a student.
Consider the following class: (download the class from Canvas under Lab 03 link)
The Course class uses an array to store the students in the course. For simplicity, assume the maximum course enrollment is 3. The array is created using new String[3]. The addStudent method adds a student to the array. Whenever a new student is added to the course, numberOfStudents is increased. The getStudents method returns the array. The dropStudent method is not implemented.
Revise the Course class as follows:
• Revise the getStudents() method to return an array whose length is the same as the number of students in the course. (Hint: create a new array and copy students to it.)
• The array size is fixed. Revise the addStudent method to automatically increase the array size if there is no room to add more students. This is done by creating a new larger array and copying the contents of the current array to it.
• Implement the dropStudent method.
Test the program by creating a Course object, add five students, and remove one student. Display the number of students and students’ names before and after removing a student.
Sample output after adding 5 students to a list of size 3; then, removing one student from the list.