-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReservation.java
More file actions
66 lines (61 loc) · 1.75 KB
/
Copy pathReservation.java
File metadata and controls
66 lines (61 loc) · 1.75 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
public class Reservation {
int ID;
String fName;
String lName;
int numOfNights;
double dailyRate;
/**
* Reservation constructor
*/
public Reservation() {
this.ID = 0;
this.fName = "John";
this.lName = "Doe";
this.numOfNights = 0;
this.dailyRate = 0;
}
/**
* Reservation constructor
* @param ID
* @param lName
* @param fName
* @param numOfNights
* @param dailyRate
*/
public Reservation(int ID, String lName, String fName, int numOfNights, double dailyRate) {
this.ID = ID;
this.lName = lName;
this.fName = fName;
this.numOfNights = numOfNights;
this.dailyRate = dailyRate;
}
/**
* Method Name: print
* Purpose: Print out the reservation
* @param temp
*/
public void print(Reservation temp) {
System.out.print("ID: " + temp.ID);
System.out.print(", Last Name: " + temp.lName);
System.out.print(", First Name: " + temp.fName);
System.out.print(", Number of Nights: " + temp.numOfNights);
System.out.print(", Daily Rate: " + temp.dailyRate + "\n");
}
/**
* Method Name: printToFile
* Purpose: Print the reservation to a file
* @param temp
* @return String to print to file
*/
public String printToFile(Reservation temp) {
return String.valueOf(temp.ID) + " " + temp.lName + " " + temp.fName + " " + String.valueOf(temp.numOfNights) + " " + String.valueOf(temp.dailyRate);
}
/**
* Method Name: getID
* Purpose: get the ID of the reservation
* @return Reservation ID
*/
public int getID() {
return this.ID;
}
}