Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Welcome dear expert,, I can't use the methods in bluej when I create the object of class, I don't know why can you check the
Welcome dear expert,, I can't use the methods in bluej when I create the object of class, I don't know why can you check the code because The problem is shown in the picture and I have not found a solution yet just I want to use the methods like add course and remove etc. this is the codes of classes : import java.util.ArrayList;
class University
private String name;
private String location;
private ArrayList faculties;
public UniversityString name, String location
this.name name;
this.location location;
this.faculties new ArrayList;
public void addFacultyFaculty faculty
faculties.addfaculty;
public void removeFacultyFaculty faculty
faculties.removefaculty;
class Faculty
private String name;
private ArrayList courses;
private ArrayList students;
public FacultyString name
this.name name;
this.courses new ArrayList;
this.students new ArrayList;
public void addCourseCourse course
courses.addcourse;
public void removeCourseCourse course
courses.removecourse;
public void admitStudentStudent student
students.addstudent;
public void expelStudentStudent student
students.removestudent;
class Course
private String name;
private String code;
private ArrayList enrolledStudents;
public CourseString name, String code
this.name name;
this.code code;
this.enrolledStudents new ArrayList;
public void enrollStudentStudent student
enrolledStudents.addstudent;
public void unenrollStudentStudent student
enrolledStudents.removestudent;
class Student
private String name;
private int ID;
private ArrayList enrolledCourses;
public StudentString name, int ID
this.name name;
this.ID ID;
this.enrolledCourses new ArrayList;
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