protected override decimal CalculatePrice(Immobile immobile) { decimal var1 = 120, var2 = 0, var3 = 0; if (NumberOfRooms < 1 || NumberOfRooms > 20) { throw new NumberOfRoomsException("Room Bound Exception"); } if (NumberOfRooms < 4) { var2 = 100; } else if (NumberOfRooms >= 4 && NumberOfRooms < 6) { var2 = 140; } else if (NumberOfRooms >= 6) { var2 = 170; } if (ConstructionYear < 1900 || ConstructionYear > 2020) { throw new YearBoundException("Year Bound Exception"); } if (ConstructionYear < 1970) { var3 = 10; } else if (ConstructionYear >= 1970 && ConstructionYear < 2000) { var3 = 20; } else if (ConstructionYear >= 2000) { var3 = 30; } return(var1 * var2 * var3 / 3); }
public void AddImmobile(Immobile immobile) { immobiles.Add(immobile); }
protected abstract decimal CalculatePrice(Immobile immobile);