-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomer.java
More file actions
103 lines (93 loc) · 2.47 KB
/
Customer.java
File metadata and controls
103 lines (93 loc) · 2.47 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
/***
* @author Carson Stotler
* @version 0.1
* Date of Creation: Oct. 13, 2022
* Last Date Modified: Oct. 18, 2022
* Assignment: HW 4
* Simulating a movie theater line with customers and servers
*/
public class Customer {
// data members
private int customerNo;
private int arrivalTime;
private int waitingTime;
/***
* 3-arg Constuctor
* @param cn int representing the customerNo
* @param at int representing the arrivalTime of customer
* @param wt int representing the waitingTime of customer
* initializes all data members to the local variables, respectively
*/
public Customer(int cn, int at, int wt){
this.customerNo = cn;
this.arrivalTime = at;
this.waitingTime = wt;
}
/***
* Getter for the customer number
* @param no parameters
* @return the value of the data member customerNo
*/
public int getCustomerNo(){
return customerNo;
}
/***
* Getter for the arrival time of a customer
* @param no parameters
* @return the value of the data member arrivalTime
*/
public int getArrivalTime(){
return arrivalTime;
}
/***
* Getter for the waiting time of a customer
* @param no parameters
* @return the value of the data member waitingTime
*/
public int getWaitingTime(){
return waitingTime;
}
/***
* Setter for the customer number
* @param cn int representing a customer's number
* no return
*/
public void setCustomerNo(int cn){
this.customerNo = cn;
}
/***
* Setter for the customer arrival time
* @param at int representing a customer's arrival time
* no return
*/
public void setArrivalTime(int at){
this.arrivalTime = at;
}
/***
* Setter for the customer waiting time
* @param wt int representing a customer's waiting time
* no return
*/
public void setWaitingTime(int wt){
this.waitingTime = wt;
}
/***
* Void method to increment waiting time for a customer
* no param
* no return
*/
public void incrementWaitingTime(){
setWaitingTime(getWaitingTime() + 1);
}
/***
* Method toString to return a formatted String of Customer information
* no parameters
* @return String of formatted customer information
*/
@Override
public String toString(){
String out = "";
out += "Customer number " + (getCustomerNo() + 1) + " arrived at time " + getArrivalTime() ;
return out;
}
}