-
Notifications
You must be signed in to change notification settings - Fork 1
/
Confirmation.java
93 lines (83 loc) · 2.94 KB
/
Confirmation.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
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
/**
* Represents Customer Confirmationsclass.
* Each confirmation includes a customer name and a six-character confirmation code (alphabetic)1. This data can be altered at any time.
* Once a seat is booked by a customer, the confirmation is added to the (existing) seat they have reserved.
* Each seat, then, either has a confirmation (booked) or not (not yet booked or released from a previous booking).
* @author Iryna Sherepot
* @version 10/6/2018
*/
public class Confirmation{
private String custName;
private String confNumber;
private boolean Aloha;
/**
* Constructor for objects of class Confirmation
*
* @param custName The name of customer on a confirmation
* @param confNumber The confirmation number - 6 characters
* @param Aloha The status if the customer belongs to Aloha discount club
*/
public Confirmation(String custName, String confNumber, boolean Aloha){
if(confNumber.length() != 6){
throw new IllegalArgumentException("Confirmation must be 6 characters long");
}
setConfirmation(custName, confNumber, Aloha);
}
/**
* Assigns values to the confirmation
*
* @param custName the name of the customer
* @param confNumber The confirmation number
* @param Aloha customer belonging to the Aloha discount club
*/
public void setConfirmation(String custName, String confNumber, boolean Aloha){
// put your code here
this.custName = custName;
this.confNumber = confNumber;
this.Aloha = Aloha;
}
//----------------------------------------------------------------------------------
//2.3 Customer Confirmations •
//Retrieve individual attributes including the confirmation number and customer name
//Make changes to the attributes
// /**
// * returns a completer confimation number
// */
//don't need this method
// public String getConfirmation(){
// return custName + confNumber;
// }
/**
* Returns customer name on a confimation.
*
* @return customer name.
*/
public String getName(){
return custName;
}
/**
* Returns a complete confimation number.
*
* @return confimation number.
*/
public String getConfNumber(){
return confNumber;
}
/**
* Returns boolen showing if a customer belongs to Aloha discount club.
*
* @return belonging to Aloha club.
*/
public boolean getAloha(){
//if(confirmation is not null)
return this.Aloha;
}
public String toString(){
String info = "";
System.out.println();
info += "\nThe confimation name is : " + this.getName() + "\n";
info += "The Confirmation number is " + this.getConfNumber() + "\n";
info += "The Full confirmation number is: " + this.getName()+ this.getConfNumber() + "\n";
return info;
}
}