-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathActivity.java
65 lines (59 loc) · 1.08 KB
/
Activity.java
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
60
61
62
63
64
65
/*
* Created by Noah Shaw
*/
public class Activity {
//Instance variables
private String name;
private int startHour;
private int endHour;
//Constructors
public Activity()
{
this.name = "rest";
this.startHour = 1;
this.endHour = 1;
}
public Activity(String aName, int aStartHour, int aEndHour)
{
this.setName(aName);
this.setStartHour(aStartHour);
this.setEndHour(aEndHour);
}
//Accessors
public String getName()
{
return this.name;
}
public int getStartHour()
{
return this.startHour;
}
public int getEndHour()
{
return this.endHour;
}
//Mutators
public void setName(String aName)
{
this.name = aName;
}
public void setStartHour(int aStartHour)
{
if(aStartHour >= 0 && aStartHour <= 23)
{
this.startHour = aStartHour;
}
}
public void setEndHour(int aEndHour)
{
if(aEndHour >= 0 && aEndHour <= 23)
{
this.endHour = aEndHour;
}
}
//Methods
public String toString()
{
return "Name: "+this.name+" Start Hour: "+this.startHour+" End Hour: "+this.endHour;
}
}