-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCourse.java
More file actions
59 lines (47 loc) · 1.13 KB
/
Course.java
File metadata and controls
59 lines (47 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import java.util.LinkedList;
/*
* @author Andrew Keyes
* Keyesandrew@live.com
*/
public class Course {
private String CourseName;
private LinkedList<Course> preReqs;
private float credits;
private float grade;
//Constructor that takes the name of the course and the number of credits
public Course(String name, float Credit){
CourseName=name;
credits=Credit;
}
//Set a Course as a prerequisite
public void setPrereq(Course preCourse){
preReqs.add(preCourse);
}
//Set the name of the Course
public void setName(String name){
CourseName=name;
}
//Set the number of credits that the Course is worth
public void setCredits(float numCreds){
credits=numCreds;
}
public float getCredits(){
return credits;
}
//Return the name of the Course
public String getName(){
return CourseName;
}
//Return the size of the array
public int numPreReqs(){
return preReqs.size();
}
//Set the grade in the course
public void setGrade(float gradenow){
grade=gradenow;
}
//Return the grade in the course
public float getGrade(){
return grade;
}
}