-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomer.java
More file actions
112 lines (102 loc) · 2.95 KB
/
Customer.java
File metadata and controls
112 lines (102 loc) · 2.95 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
104
105
106
107
108
109
110
111
112
import java.util.ArrayList;
/**
* Write a description of class Customer here.
*
* @author (Pan Qi)
* @version (a version number or a date)
*/
public class Customer extends User
{
private String address;
private String phone;
private boolean registerCondition;
/**
* A defualt constructor for objects of class Customer.
*/
public Customer()
{
super();
address = "";
phone = "";
registerCondition = true;
}
/**
* A constructor for objects of class Customer.
* Passing parameter name, id, email, password, address, phone, condition.
*/
public Customer(String name,String id,String email,String password,String address,String phone,boolean condition)
{
super(name,id,email,password);
this.address = address;
this.phone = phone;
registerCondition = condition;
}
/**
* Create a displayCustomer method to display the customer's information.
* It invokes getId(), getName() and getEmail() method.
*/
public void displayCustomer()
{
System.out.println("Customer ID: " + getId());
System.out.println("Customer Name: " + getName());
System.out.println("Phone Number: " + phone);
System.out.println("Email: " + getEmail());
System.out.println("Address: " + address);
System.out.println("---------------------------------------------------------------");
}
/**
* Create a getAddress method to get the address.
*/
public String getAddress()
{
return address;
}
/**
* Create a getDetail method to judge whether the user register, if register, it will print the user's details.
*/
public String getDetail()
{
String registerConditionString = "";
if (registerCondition == true)
registerConditionString = "1";
else
registerConditionString = "0";
String detail = getName() + "," + getId() + "," + getEmail() + "," + getPassword() + "," + address + "," + phone + "," + registerConditionString;
return detail;
}
/**
* Create a getPhone method to get the phone.
*/
public String getPhone()
{
return phone;
}
/**
* Create a getRegisterCondition method to get the registerCondition.
*/
public boolean getRegisterCondition()
{
return registerCondition;
}
/**
* Create a setAddress method to transfer newAddress to address.
*/
public void setAddress(String newAddress)
{
address = newAddress;
}
/**
* Create a setPhone method to transfer newPhone to phone.
*/
public void setPhone(String newPhone)
{
phone = newPhone;
}
/**
* Create a setRegisterCondition method to transfer condition to registerCondition.
*/
public void setRegisterCondition(boolean condition)
{
registerCondition = condition;
}
}