From fafa53ffb7b708907387423e80726de167b0fc9d Mon Sep 17 00:00:00 2001 From: Johannes Schmelz Date: Wed, 13 Nov 2024 23:49:37 +0100 Subject: [PATCH] rent calculation --- .../model/fields/BuildingProperty.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BuildingProperty.java b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BuildingProperty.java index 01cf896..9518ded 100644 --- a/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BuildingProperty.java +++ b/Projekte/monopoly/model/src/main/java/pp/monopoly/model/fields/BuildingProperty.java @@ -13,10 +13,21 @@ public class BuildingProperty extends PropertyField { @Override protected int calcRent() { - if(!hotel) { - return rent*houses; - } else { - return rent*6; + if (hotel) { + return (int) Math.round(rent*4.95*2.93*2.67*1.35*1.26); + } + switch (houses) { + case 1: + return (int) Math.round(rent*4.95); + case 2: + return (int) Math.round(rent*4.95*2.93); + case 3: + return (int) Math.round(rent*4.95*2.93*2.67); + case 4: + return (int) Math.round(rent*4.95*2.93*2.67*1.35); + + default: + return rent; } }