private void CalculateAmount() { int hours = ConvertDate.GetCheckInAndCheckOutTimes(EntryDate, departureDate); if (typeof(Car).IsInstanceOfType(Vehicle)) { Amount = (Vehicle as Car).CalculateAmountCar(hours); } else if (typeof(Motorcycle).IsInstanceOfType(Vehicle)) { Amount = (Vehicle as Motorcycle).CalculateAmountMotorcycle(hours); } else { throw new CalculateAmountException(); } }