-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomer.java
107 lines (90 loc) · 2.82 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
//NIHAN AKINCI
public class Customer
{
private int customerId ;
private String customerName;
private String customerSurname;
private String customerGender;
private double customerCredit;
public Customer()
{}
public Customer(int customerId, String customerName, String customerSurname, String customerGender, double customerCredit)
{
this.customerId = customerId;
this.customerName = customerName;
this.customerSurname = customerSurname;
this.customerGender = customerGender;
this.customerCredit = customerCredit;
}
public int getId()
{
return customerId;
}
public void setId(int customerId)
{
this.customerId = customerId;
}
public String getName()
{
return customerName;
}
public void setName(String customerName)
{
this.customerName = customerName;
}
public String getSurname()
{
return customerSurname;
}
public void setSurname(String customerSurname)
{
this.customerSurname = customerSurname;
}
public String getGender()
{
return customerGender;
}
public void setGender(String customerGender)
{
this.customerGender = customerGender;
}
public double getCredit()
{
return customerCredit;
}
public void setCredit(double customerCredit)
{
this.customerCredit = customerCredit;
}
@Override
public String toString()
{
return this.getId() + " " + this.getName() + " " + this.getSurname() + " " + this.getGender() + " " + this.getCredit();
}
public void creditAdding(double creditAdding)
{
if (creditAdding <= 0)
{
System.out.println("You cannot add negative values and zero.");
}
else
{
customerCredit = customerCredit + creditAdding;
}
}
public void creditWithdrawing( double creditWithdrawing )
{
if (customerCredit < creditWithdrawing)
{
System.out.println("Insufficient balance.");
}
else
{
customerCredit = customerCredit - creditWithdrawing;
}
}
public String getBalance()
{
return ""+customerCredit;
}
}