-
Notifications
You must be signed in to change notification settings - Fork 0
/
Buyer.java
64 lines (52 loc) · 1.69 KB
/
Buyer.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
/**
* Buyer
* a buyer account class that represents a buyer
* Nicholas de la Espriella
* 4/13/2017
*/
package C212Amazon;
import java.util.HashMap;
import java.util.Date;
public class Buyer extends Account {
// parameters
private Cart cart; // Cart class
private int totalCost = 0; // Total cost of item selected.
private int currentNumberOfItem = 0; // Current number of items.
private String firstName; // User's first name.
private String lastName; // User's last name.
private String phone; // User's contact.
// constructor
public Buyer(int uniqueID, String username, String password, String firstName, String lastName, String phone, String email) {
super(uniqueID, username, password, email);
this.firstName = firstName; // first name
this.cart = new Cart(uniqueID);
this.lastName = lastName; // last name
this.phone = phone; // phone
}
/**
* Method to get the first name.
* @return The first name.
*/
public String getFirstName() {
return firstName;
}
/**
* Method to get the last name
* @return The last name
*/
public String getLastName() {
return lastName;
}
/**
* Method to get user's contact
* @return user's contact
*/
public String getPhone() {
return phone;
}
public Cart getCart() { return cart; }
public String toString() {
return getUserName() + " " + firstName + " " + lastName + " " + getUniqueID()
+ " " + getEmailAddress() + " " + phone;
}
}