From 93deea6777915df71e1b11717bc6b56ebf3b5d1e Mon Sep 17 00:00:00 2001 From: "MELLON\\wroot" Date: Sun, 20 Dec 2020 22:31:53 +0300 Subject: [PATCH] Agreement bug fix. --- src/models/TakePercentage.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/models/TakePercentage.java b/src/models/TakePercentage.java index 4ef2102..e1a43db 100644 --- a/src/models/TakePercentage.java +++ b/src/models/TakePercentage.java @@ -3,10 +3,10 @@ public class TakePercentage extends ContiuousOffer { // properties private City city; - private double percentage; + private int percentage; // constructor - public TakePercentage(City city, double percentage){ + public TakePercentage(City city, int percentage){ this.city = city; this.percentage = percentage; } @@ -14,8 +14,9 @@ public TakePercentage(City city, double percentage){ @Override public void performOffer(Player firstPlayer, Player secondPlayer) { // get percentage of rent from secondPlayers city - firstPlayer.addMoney(city.getRent() * percentage); - secondPlayer.addMoney(city.getRent() * (1 - percentage)); + double rate = ((double)percentage)/10; + firstPlayer.addMoney(city.getRent() * rate); + secondPlayer.addMoney(city.getRent() * (1 - rate)); } @Override