-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRental.java
51 lines (40 loc) · 1.28 KB
/
Rental.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
/**
* Rental
*/
public class Rental {
public final static byte NUMBER_OF_MINUTES_IN_HOUR = 60;
public final static byte HOURLY_RENTAL = 40;
private String contractNumber;
private short rentalHours;
private short rentalMinutes;
private short price;
public void setHoursAndMinutes(short minutes){
this.rentalHours = (short)(minutes / NUMBER_OF_MINUTES_IN_HOUR);
this.rentalMinutes = (short)(minutes - (this.rentalHours * NUMBER_OF_MINUTES_IN_HOUR));
this.price = (short)(this.rentalHours * HOURLY_RENTAL + this.rentalMinutes);
}
public String getContractNumber() {
return contractNumber;
}
public void setContractNumber(String contractNumber) {
this.contractNumber = contractNumber;
}
public short getRentalHours() {
return rentalHours;
}
public void setRentalHours(short rentalHours) {
this.rentalHours = rentalHours;
}
public short getRentalMinutes() {
return rentalMinutes;
}
public void setRentalMinutes(short rentalMinutes) {
this.rentalMinutes = rentalMinutes;
}
public short getPrice() {
return price;
}
public void setPrice(short price) {
this.price = price;
}
}