-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathBillService.java
37 lines (28 loc) · 1.31 KB
/
BillService.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
package com.geektrust.backend.Services;
import com.geektrust.backend.Entites.Apartment;
public class BillService implements IBillservice{
protected Apartment apartment;
private Integer waterConsumptionOfGuests = 0;
private Integer waterConsumptionOfResident = 0;
WaterConsumptionService waterConsumptionService;
CalculateCostService calculateCostService;
public BillService(Apartment apartment,WaterConsumptionService waterConsumptionService,CalculateCostService calculateCostService)
{
this.apartment = apartment;
this.waterConsumptionService = waterConsumptionService;
this.calculateCostService = calculateCostService;
}
public Integer calculateBill()
{
Integer CostOfGuests = calculateCostService.calculateCostOfGuests();
Integer CostOfResidents = calculateCostService.CalculateCostOfResidents();
return CostOfResidents + CostOfGuests;
}
public Integer calculateWaterConsumption()
{
waterConsumptionOfGuests = waterConsumptionService.WaterConsumptionOfGuests();
waterConsumptionOfResident = waterConsumptionService.WaterConsumptionOfResident();
Integer totalConsumption = waterConsumptionOfGuests + waterConsumptionOfResident;
return totalConsumption;
}
}