-
Notifications
You must be signed in to change notification settings - Fork 1
/
Customer.java
121 lines (75 loc) · 2.32 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
117
118
119
120
121
import java.io.Serializable;
public class Customer extends Person implements Serializable {
private String ID;
private String password;
private Car car;
private double totalBill;
private String BookingID;
private String dayForRent;
public Customer() {
super();
}
public Customer(String firstName, String lastName, String email, String phoneNo, String CNIC, String ID, Car car, String BookingID, String dayForRent, String password) {
super(firstName, lastName, email, phoneNo, CNIC);
this.ID=ID;
this.password=password;
this.car=car;
this.BookingID=BookingID;
this.dayForRent=dayForRent;
}
public String getID() {
return ID;
}
public void setID(String iD) {
ID = iD;
}
public Car getCar() {
return car;
}
public void setCar(Car car) {
this.car = car;
}
public String getBookingID() {
return BookingID;
}
public void setBookingID(String bookingID) {
BookingID = bookingID;
}
public double getTotalBill() {
return totalBill;
}
public void setTotalBill(double totalBill) {
this.totalBill = totalBill;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getDayForRent() {
return dayForRent;
}
public void setDayForRent(String dayForRent) {
this.dayForRent = dayForRent;
}
public int totalBillOfCustomer() {
long totalTime = Integer.parseInt(dayForRent)*24;
int rentPerHour = this.getCar().getRentPerHour();
if (totalTime != 0) {
return (int) (rentPerHour * totalTime);
} else {
return rentPerHour;
}
}
@Override
public String toString() {
return
super.toString() +
"ID= " + getID() + "\n"+
"Car= "+ getCar() + "\n" +
"Total Bill= "+ totalBillOfCustomer() + "\n" +
"Booking ID= "+ getBookingID() + "\n" +
"Rent Time= "+ getDayForRent() + "\n" ;
}
}