-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathAllotWaterCommand.java
More file actions
25 lines (19 loc) · 842 Bytes
/
AllotWaterCommand.java
File metadata and controls
25 lines (19 loc) · 842 Bytes
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
package com.geektrust.backend.Commands;
import java.util.List;
import com.geektrust.backend.Ratio;
import com.geektrust.backend.Services.AllotWaterService;
public class AllotWaterCommand implements Icommand {
AllotWaterService allotWaterService;
public AllotWaterCommand(AllotWaterService allotWaterService)
{
this.allotWaterService = allotWaterService;
}
@Override
public void execute(List<String> tokens) {
Integer ApartmentType = Integer.valueOf(tokens.get(1));
int corporationRatio = Integer.parseInt(tokens.get(2).split(":")[0]);
int borewellratio = Integer.parseInt(tokens.get(2).split(":")[1]);
Ratio ratio = new Ratio(Integer.valueOf(corporationRatio),Integer.valueOf(borewellratio));
allotWaterService.AllotWater(ApartmentType, ratio);
}
}