Hello I am working on a Course.java program. I need to include courseName, cours
ID: 674206 • Letter: H
Question
Hello I am working on a Course.java program. I need to include courseName, courseDescription, courseInstructor, and numberofstudents and an array of students. the constructor should intialize all the attributes and allocate an empty array of students.
My course program so far:
public class Course {
private String courseName;
private Student[]
students = new Student[100];
private int numberofStudents;
public Course(String courseName) {
this.courseName = courseName;
}
public void addStudent(String[] Student) {
students[numberofStudents] = student[];
numberofStudents++;
}
public Student[] getStudent() {
return Student;
}
public int getnumberofStudents() {
return numberofStudents;
}
public String getCourseName() {
return courseName;
}
public void dropStudent(String student) {
}
}
Explanation / Answer
public class Course {
private String courseName,courseDescription,courseInstructor;
private Student[]
students = new Student[100];
private int numberofStudents;
public Course(String courseName) {
this.courseName = courseName;
}
public void addStudent(String[] Student) {
students[numberofStudents] = student[];
numberofStudents++;
}
public Student[] getStudent() {
return Student;
}
public int getnumberofStudents() {
return numberofStudents;
}
public String getCourseName() {
return courseName;
}
public String getCourseDescription(){
return courseDescription;
}
public String getCourseInstructor(){
return courseInstructor;
}
public void dropStudent(String student) {
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.