-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReservation.java
More file actions
80 lines (67 loc) · 1.59 KB
/
Reservation.java
File metadata and controls
80 lines (67 loc) · 1.59 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
//Sina Pahlavan
//501 034 271
/*
* A simple class to model an electronic airline flight reservation
*
* This class has been done for you
*/
public class Reservation
{
String flightNum;
String flightInfo;
boolean firstClass;
String passengerName;
String passengerPassport;
String seat;
public Reservation(String flightNum, String info)
{
this.flightNum = flightNum;
this.flightInfo = info;
this.firstClass = false;
}
public Reservation(String flightnum,Passenger aPassenger){
flightNum = flightnum;
this.flightInfo = " ";
this.firstClass = false;
this.passengerName = aPassenger.getName();
this.passengerPassport = aPassenger.getPassportNum();
this.seat = aPassenger.getSeatNum();
}
public boolean isFirstClass()
{
return firstClass;
}
public void setFirstClass()
{
this.firstClass = true;
}
public String getFlightNum()
{
return flightNum;
}
public String getFlightInfo()
{
return flightInfo;
}
public void setFlightInfo(String flightInfo)
{
this.flightInfo = flightInfo;
}
public void print()
{
System.out.println(flightInfo);
}
public boolean equals(Reservation one, Reservation two){
/**
* @ param : two reservation objects
* Returns true if the one and two have the same flight num, name, and passport number
*/
if (one.flightNum.equals(two.flightNum) && one.passengerName.equals(two.passengerName)){
return true;
}
return false;
}
public String toString(){
return "Flight Number: " + flightNum + "\t" + "Name: " + passengerName + "\t" + "Passport Number: " + passengerPassport + "\t" + " Seat Number: " +seat;
}
}