forked from Izaiah-M/CakeShop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomer.java
100 lines (81 loc) · 2 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
package CakeShop;
public class Customer {
private int id;
private String name;
private String email;
private int contact;
private String address;
private String password;
public ShoppingCart cart;
// this automatically adds a new instance of the shopping cart to the customer when a new customer is created
public Customer() {
this.AddCart();
}
public Customer(String name, String email, int contact, String address, String password) {
this.setName(name);
this.setEmail(email);
this.setContact(contact);
this.setAddress(address);
this.setPassword(password);
this.AddCart();
}
// Constructor that takes in a shopping cart object
public Customer(String name, ShoppingCart cart) {
this.setName(name);
this.cart = cart;
}
// Second constructor that takes in an ID.
public Customer(int id, int contact, String name, String email, String address) {
this.setName(name);
this.setEmail(email);
this.setContact(contact);
this.setAddress(address);
this.id = id;
this.AddCart();
}
public void setName(String name) {
this.name = name;
}
public void setEmail(String email) {
this.email = email;
}
public void setContact(int contact) {
this.contact = contact;
}
public void setAddress(String address) {
this.address = address;
}
public void setPassword(String Password) {
this.password = Password;
}
//TODO adding shopping cart
//would this make more sense as in the part of adding and attaching a cart object to the Customer?
public void AddCart() {
this.cart = new ShoppingCart();
}
public String getName() {
return name;
}
public String getEmail() {
return email;
}
public int getContact() {
return contact;
}
public int getCustId() {
return id;
}
public String getAddress() {
return address;
}
public String getPassword() {
return this.password;
}
public ShoppingCart getCart() {
return this.cart;
}
// Should return for us, customer name and shopping cart
public String toString() {
return this.name + " purchasing: " + this.cart;
}
}