-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.java
More file actions
157 lines (143 loc) · 3.43 KB
/
Copy pathProgram.java
File metadata and controls
157 lines (143 loc) · 3.43 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/**
* A program has a time, location, a group size, a contact person, and a
* contact number.
*
* @author KaiYuan
* @version 2018-03-06
*/
public class Program
{
//instance fields declaration
private int startTime;
private int endTime;
private String location;
private int group;
private String firstName;
private String lastName;
private int phone;
/**
* Constract a program with a start time, end time, location, group
* size, contact name and phone number
*
* @param start the program's start time
* @param end the program's end time
* @param loc the program's location
* @param gro the size of the group participating the program
* @param first the program's contact's first name
* @param last the program's contact's last name
* @param phonenum the program's contact's phone number
*/
public Program(int start, int end, String loc, int gro, String first,
String last, int phonenum)
{
//if start time is before 0800 or after 2000, then it is invalid
startTime = start;
//if end time is before 0800 or after 2000, then it is invalid
endTime = end;
//two program cannot be happening at the same location
location = loc;
//a group size cannot be negative
if(gro < 0)
{
group = 0;
}
else
{
group = gro;
}
firstName = first;
lastName = last;
phone = phonenum;
}
/*
* Accesors
*/
/**
* Return the program's start time
*
* @return program's start time
*/
public int getStartTime()
{
return startTime;
}
/**
* Return the program's end time
*
* @return program's end time
*/
public int getEndTime()
{
return endTime;
}
/**
* Display the time period as a String
*
* @return the time period of a program as a String
*/
public String displayTimePeriod()
{
String period = startTime + "-" + endTime;
return period;
}
/**
* Return the program's location
*
* @return program's location
*/
public String getLocation()
{
return location;
}
/**
* Return the program's group size
*
* @return program's group size
*/
public int getGroupSize()
{
return group;
}
/**
* return the program's contact first name
*
* @return program's contact first name
*/
public String getFirstName()
{
return firstName;
}
/**
* return the program's contact last name
*
* @return program's contact last name
*/
public String getLastName()
{
return lastName;
}
/**
* return the whole name of the program's contact
*
* @return the whole name of the program's contact
*/
public String getWholeName()
{
String name = firstName + " " + lastName;
return name;
}
/**
* return the program's contact phone number
*
* @return program's contact phone number
*/
public int getPhone()
{
return phone;
}
/*
* programs are provided by another department, it will be taken from
* an existing formatted file. User is unable to mutate any
* information here.
*/
}