-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCustomer.java
116 lines (99 loc) · 2.3 KB
/
Customer.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import java.io.Serializable;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
/**
* This class creates a Customer and assigns a unique ID to the Customer upon
* creation
*
* @author Matt Carlson, Jamison Czech, Slava Makharovich, Prashant Shrestha
*/
public class Customer implements Serializable{
// Unique identifier assigned to a new customer
private static long ID = 1L;
private String name;
private String address;
private String phoneNumber;
private String customerID;
private List customerCard = new LinkedList();
/**
* Creates a new Customer assigning a unique ID and default balance
*
* @param name
* @param address
* @param phoneNumber
*/
public Customer(String name, String address, String phoneNumber) {
this.name = name;
this.address = address;
this.phoneNumber = phoneNumber;
this.customerID = Long.toString(ID);
ID++;
}
// INCOMPLETE
public boolean insertCard(CreditCard creditCard) {
return customerCard.add(creditCard);
}
// INCOMPLETE
public void removeCard(CreditCard creditCard) {
customerCard.remove(creditCard);
}
/**
* Getter for list of cards for a Customer
*
* @return an iterator of a customer's credit cards
*/
public Iterator getCustomerCard() {
return customerCard.listIterator();
}
/**
* Gets number of cards a customer has on file
*
* @return an int of the number of cards a customer has on file
*/
public int cardCount() {
return customerCard.size();
}
/**
* Gets customer's name
*
* @return a string of the customer's name
*/
public String getName() {
return name;
}
/**
* Gets customer's address
*
* @return a string of the customer's address
*/
public String getAddress() {
return address;
}
/**
* Gets customer's phone number
*
* @return a string of the customer's phone number
*/
public String getPhoneNumber() {
return phoneNumber;
}
/**
* Get the customer's ID number
*
* @return a long of the customer's ID number
*/
public String getCustomerID() {
return customerID;
}
/**
* String representing a customer
*
* @return a string representing a customer
*/
@Override
public String toString() {
return "Customer ID: " + customerID + " Name: " + name + " Address: "
+ address + " Phone number: " + phoneNumber;
}
}