Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( The Course class ) Revise the Course class as follows: ( DON T use ArrayList ) The array size is fixed in Listing 1

(The Course class)
Revise the Course class as follows:
(DONT use ArrayList)
The array size is fixed in Listing 10.6. Course.java Download Course.javaImprove it to automatically increase the array size by creating a new larger array and copying the contents of the current array to it.( default capacity =16, increased the size of array to the double if necessary)
Implement the dropStudent method. If the student to be dropped cant be found, do nothing.
Add the instructors information into the class.
Add a method, clear(), removes all students from the course.
Add a method, print(), displays course information with the Course Name, Instructor's name, the number of students enrolled, and the list of students' names.
Write a test program (Assignment5.java) that creates a course with default capacity, adds twenty students, removes three, adds another two, then displays the course info. Call clear() and display the course info again.
Submit your source codes (Course.java and Assignment5.java) and screenshots at Canvas.
Late penalty: 5 points off for each day late. 5-point off for the resubmission after grading. The resubmission should be made within 2-days after grading to avoid additional late penalty.
Comment your name and ID in the first line of each source file.
UML diagram:
package Module5;
public class Course {
private String courseName;
private String[] students = new String[100];
private int numberOfStudents;
public Course(String courseName){
this.courseName = courseName;
}
public void addStudent(String student){
students[numberOfStudents]= student;
numberOfStudents++;
}
public String[] getStudents(){
return students;
}
public int getNumberOfStudents(){
return numberOfStudents;
}
public String getCourseName(){
return courseName;
}
public void dropStudent(String student){
// Left as an exercise in Exercise 9.9
}
}
UML diagram:
Course
courseName: String
instructor: String
studentList: String[]
capacity: int
numberOfStudents: int
Course(name: String)
Course(name: String, instuctor: String)
getCourseName(): String
setInstructor(instructor: String): void
getInstructor(): String
addStudent( student: String): void
dropStudent(student: String): void
getStudents(): string[]
getNumberOfStudents(): int
print(): void
clear(): void
image text in transcribed

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: 3

blur-text-image

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

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions