Added courses

This commit is contained in:
HeshamTB 2019-01-28 13:55:50 +03:00
parent d46111b059
commit 3a2705794a
2 changed files with 45 additions and 0 deletions

11
src/Course.java Normal file
View File

@ -0,0 +1,11 @@
public enum Course {
EE201,
EE202,
IE201,
IE200,
ISLS201,
EE250
}

View File

@ -1,8 +1,11 @@
import java.util.ArrayList;
import java.util.List;
public class Education {
private String School;
private String Major;
private Level level;
private List<Course> courses = new ArrayList<Course>(6);
public Education(String school, String major, Level lvl) {
School = school;
@ -10,6 +13,31 @@ public class Education {
level = lvl;
}
public List<Course> getCourses() {
return courses;
}
public void addCourse(Course course) {
this.courses.add(course);
}
public boolean addCourses(List<Course> courses) {
if (canAddCourse()) {
for (Course course : courses) {
this.courses.add(course);
}
return true;
}
else return false;
}
public boolean canAddCourse() {
if (courses.size() == 6) {
return false;
}
else return true;
}
public String getSchool() {
return School;
}
@ -32,5 +60,11 @@ public class Education {
public void setLevel(Level level) {
this.level = level;
}
public int numberOfCourses() {
return courses.size();
}
}