Commit d13886c8 authored by Roham's avatar Roham

YO

parent 5daefdf7
package com.university;
public class Course {
String ID;
public Course(String ID, String name, Department department, Professor professor, int credit) {
}
public String getID(){
return null;
}
public Department getDepartment(){
return null;
}
public String getName() {
return null;
}
public Student[] getStudents() {
return null;
}
public Professor getProfessor() {
return null;
}
public int getCredit() {
return 0;
}
public void enrollStudent(Student student){
}
}
package com.university;
import java.util.ArrayList;
import java.util.List;
public class Department {
String name;
List<Student> students;
List<Course> courses;
List<Professor> professors;
public Department(String name) {
this.name = name;
this.students = new ArrayList<>();
this.courses = new ArrayList<>();
this.professors = new ArrayList<>();
}
public String getName(){
return this.name;
}
public void addStudent(Student student){
this.students.add(student);
}
public Student[] getStudents(){
return (Student[])this.students.toArray();
}
public void removeStudent(Student student){
this.students.remove(student);
}
public void addCourse(Course course){
this.courses.add(course);
}
public Course[] getCourses(){
return (Course[])this.courses.toArray();
}
public void removeCourse(Course course){
this.courses.remove(course);
}
public void addProfessor(Professor student){
this.professors.add(student);
}
public Professor[] getProfessors(){
return (Professor[])this.professors.toArray();
}
public void removeProfessor(Professor professor){
this.professors.remove(professor);
}
}
package com.university;
import java.util.ArrayList;
import java.util.List;
public class Professor {
Department department;
String name;
List<Course> courses;
public Professor(Department department, String name) {
this.department = department;
this.name = name;
this.courses = new ArrayList<>();
}
public Department getDepartment() {
return this.department;
}
public String getName() {
return this.name;
}
public Course[] getCourses() {
return (Course[])this.courses.toArray();
}
}
package com.university;
public class Student {
public Student(String name, String ID, String major, Department department) {
}
public String getName() {
return null;
}
public String getID() {
return null;
}
public String getMajor() {
return null;
}
public Department getDepartment() {
return null;
}
public Course[] getCourses() {
return null;
}
public void addCourse(Course course){
}
}
package com.university;
import java.util.ArrayList;
import java.util.List;
public class University {
List<Department> departments = new ArrayList<>();
public Department[] getDepartments(){
return (Department[])this.departments.toArray();
}
public void addDepartment(Department department){ this.departments.add(department);}
public void removeDepartment(Department department){ this.departments.remove(department);}
}
import static org.junit.jupiter.api.Assertions.*;
class CourseTest {
}
\ No newline at end of file
import static org.junit.jupiter.api.Assertions.*;
class StudentTest {
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment