Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.6 kB
2
Indexable
Never
from carHire import carHire

def main():
    print(f'{"-" * 12}LUXCARS LUXURY CAR HIRE{"-" * 12}\n')
    clientName = input("Please input client name: ")
    hireDate = input("Please input hire date: ")
    carMake = input("\nHire cost depends on the type of luxury sports car\nFE - (FERRARI), LA - (LAMBORGHINI), MA - (MASERATI)\nPlease select your car type: ").lower()
    hireInputError = False
    while True:
        if hireInputError == False:
            hirePeriod = int(input("Hire period (hours): "))
        else:
            hirePeriod = int(input("Please enter a valid hire period, between 1 and 24 (hours): "))

        if hirePeriod <= 24 and hirePeriod > 0:
            break
        else:
            hireInputError = True
            pass
        
    carAmountInputError = False
    while True:
        if carAmountInputError == False:
            amountOfCars = int(input("Number of cars required: "))
        else:
            amountOfCars = int(input("Number of cars required, maximum is 5: "))
        
        if amountOfCars > 0 and amountOfCars <= 5:
            break
        else:
            carAmountInputError = True
            pass

    order = carHire(clientName, hireDate, carMake, amountOfCars, hirePeriod)

    order.getTotalHireCost()
    print(f'\n{"*" * 10}Car Hire Cost Calculations{"*" * 10}\n\nCar hire calculation for {order.getClientName()} on {order.getBookingDate()}\nHourly hire rate $ {order.getHourlyRate():.2f}\nTotal Hire Cost $ {order.getTotalHireCost():.2f} for {order.getNumCars()} cars for {order.getTotalHours()} hours')

main()