USE PYTHON. Notice that the output needs to be as it is required.
4.18 LAB*: Program: Automobile service invoice
(1) Output a menu of automotive services and the corresponding
cost of each service. (2 pts)
Ex:
Davy's auto shop services Oil change -- $35 Tire rotation -- $19 Car wash -- $7 Car wax -- $12
(2) Prompt the user for two services from the menu. (2
pts)
Ex:
Select first service: Oil change Select second service: Car wax
(3) Output an invoice for the services selected. Output the cost
for each service and the total cost. (3 pts)
Davy's auto shop invoice Service 1: Oil change, $35 Service 2: Car wax, $12 Total: $47
(4) Extend the program to allow the user to enter a dash (-),
which indicates no service. (3 pts)
Ex:
Davy's auto shop services Oil change -- $35 Tire rotation -- $19 Car wash -- $7 Car wax -- $12 Select first service: Tire rotation Select second service: - Davy's auto shop invoice Service 1: Tire rotation, $19 Service 2: No service Total: $19
def automotive_service(): print("To select service from the menu type service name. If you don't want to select any service you can enter -."); service1 = input("Select first service: ").lower(); service2 = input("Select second service: ").lower(); if service1 not in services.keys() or service2 not in services.keys(): print("Please enter valid service from menu") automotive_service() else: if service1 == '-': print('Service 1: No service'); else: print('Service 1: ' + service1 + ', $' + services[service1]); if service2 == '-': print('Service 2: No service'); else: print('Service 2: ' + service2 + ', $' + services[service2]); total = int(services[service1]) + int(services[service2]) print("Total: $" + str(total)); if __name__ == '__main__': print("Davy'a auto shop services"); print("Oil change -- $35 \nTire rotation -- $19 \nCar wash -- $7 \nCar wax -- $12"); services = { 'oil change': '35', 'tire rotation': '19', 'car wash': '7', 'car wax': '12', '-': '0' } automotive_service()
If you like the answer please don't forget to upvote. Thank you Stay safe
Get Answers For Free
Most questions answered within 1 hours.