-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVaccineAppointment.java
More file actions
66 lines (60 loc) · 1.82 KB
/
VaccineAppointment.java
File metadata and controls
66 lines (60 loc) · 1.82 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
package csci1011.assign6;
/**CSCI 1010 Assign 6
* @author Benjamin Howard
* Class to create VaccineAppointment objects with constructor, accessor, and toString methods
*/
public class VaccineAppointment {
private String patientName;
private String email;
private String timeOfAppt;
private boolean isAvailable;
/* Contructs appointment based on appointment time,
email and same set to default and are later gathered
by the signUp() method
*/
public VaccineAppointment(String newApptTime)
{
this.patientName = "no name";
this.email = "no email";
this.timeOfAppt = newApptTime;
this.isAvailable = true;
}
/* Constructor to set new email and name for an appointment,
Finalizes and makes the appointment not available for anyone else
*/
public void signUp(String newPatientName, String newEmail)
{
this.patientName = newPatientName;
this.email = newEmail;
this.isAvailable = false;
}
// Returns time of Appt
public String getTime()
{
return(this.timeOfAppt);
}
//Returns availability (Either true or false)
public boolean getIsAvailable()
{
if(this.isAvailable == true)
{
return(true);
}
else if(this.isAvailable == false)
{
return(false);
}
return(this.isAvailable);
}
/*Converts Appointment to a string for
so it can be written to log in a organized way
*/
public String toString()
{ String time = this.timeOfAppt;
String name = this.patientName;
String email = this.email;
String output = time + " - " + name +" (" +email +")";
System.out.println(time + " - " + name +" (" +email +")");
return(output);
}
}