If the input is: Tire shine Wax the output is: ZyCar Wash Base car wash -- $10 Tire shine -- $2 Wax- $3 ‒‒‒‒ Total price: $15 If the input is: Rain repellent the output is: ZyCar Wash Base car wash Rain repellent ---- Total price: $12 1 def...(): BA 2 -- Troubleshooting • If you are getting a keyError, you might be trying to retrieve a cost for the service that was not selected and was marked with a -. Revise your if/elif statements to change when/how you are retrieving the values from the dictionary. 414136.2652726.qxzqy7 3 4 if -- LAB ACTIVITY 3.21.1: LAB: Car Wash 5 6 7 8 9 10 11 $10 $2 main.py service choice1=input() service_choice2=input() _name_ __main_": services = {'Air freshener': 1, 'Rain repellent': 2, 'Tire shine': 2, 'wax': 3, 'Vacuum' : 5 } base_wash= total e 0/14 Load default template...

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Example
If the input is:
Tire shine
Wax
the output is:
ZyCar Wash
Base car wash -- $10
Tire shine
$2
Wax
$3
Total price: $15
If the input is:
--
Rain repellent
the output is:
----
ZyCar Wash
Base car wash -- $10
Rain repellent
$2
--
Total price: $12
LAB
ACTIVITY
Troubleshooting
• If you are getting a keyError, you might be trying to retrieve a cost for the service that was not selected and was marked with a -.
Revise your if/elif statements to change when/how you are retrieving the values from the dictionary.
414136.2652726.qx3zqy7
6
7
8
--
9
10
11
3.21.1: LAB: Car Wash
1 def...():
2
3
4 if name == _main__":
5
services = {'Air freshener': 1, 'Rain repellent': 2, 'Tire shine': 2, "wax': 3, "Vacuum' : 5 }
base_wash =
total = 0
main.py
service_choice1=input()
service_choice2 = input()
0/14
Load default template...
Transcribed Image Text:Example If the input is: Tire shine Wax the output is: ZyCar Wash Base car wash -- $10 Tire shine $2 Wax $3 Total price: $15 If the input is: -- Rain repellent the output is: ---- ZyCar Wash Base car wash -- $10 Rain repellent $2 -- Total price: $12 LAB ACTIVITY Troubleshooting • If you are getting a keyError, you might be trying to retrieve a cost for the service that was not selected and was marked with a -. Revise your if/elif statements to change when/how you are retrieving the values from the dictionary. 414136.2652726.qx3zqy7 6 7 8 -- 9 10 11 3.21.1: LAB: Car Wash 1 def...(): 2 3 4 if name == _main__": 5 services = {'Air freshener': 1, 'Rain repellent': 2, 'Tire shine': 2, "wax': 3, "Vacuum' : 5 } base_wash = total = 0 main.py service_choice1=input() service_choice2 = input() 0/14 Load default template...
The function to compute the cost and print the receipt
Write a function to print the formatted output and return the total price for the selected car wash services.
Write a function car_wash_service() that takes the following parameters:
• a base price for a car wash,
• a dictionary that lists the services and their prices,
• two strings that contain the names of the services that were selected.
For example, if no services were selected and the provided base price is 10 dollars, the function prints the following:
ZyCar Wash
Base car wash
----
--
$10.00
Total price: $10.00
Notice that the output that you see above is produced from within the function.
1. In your function, you need to extract the cost of each service based on the provided values.
2. Calculate the total for the services: the base car wash and the two additional services.
3. Print the receipt of all selected services with their cost, then the total price.
Hint: Use the service name values to index the dictionary - this would get you the corresponding service cost.
See additional examples of the output below.
The main program
Your main program will need to process the user input and correctly call the car_wash_service () function.
1. Set the base car wash price to $10.
2. A dictionary with each additional service and the corresponding cost has been provided.
3. Get the user input:
3.1. The service name has to match the key in the dictionary.
3.2. Two additional services can be selected. If the user does not need additional service, they can use a
additional service.
4. Call the function to output all selected services along with the corresponding costs and then the total price for all car wash services.
as an input to reject an
Transcribed Image Text:The function to compute the cost and print the receipt Write a function to print the formatted output and return the total price for the selected car wash services. Write a function car_wash_service() that takes the following parameters: • a base price for a car wash, • a dictionary that lists the services and their prices, • two strings that contain the names of the services that were selected. For example, if no services were selected and the provided base price is 10 dollars, the function prints the following: ZyCar Wash Base car wash ---- -- $10.00 Total price: $10.00 Notice that the output that you see above is produced from within the function. 1. In your function, you need to extract the cost of each service based on the provided values. 2. Calculate the total for the services: the base car wash and the two additional services. 3. Print the receipt of all selected services with their cost, then the total price. Hint: Use the service name values to index the dictionary - this would get you the corresponding service cost. See additional examples of the output below. The main program Your main program will need to process the user input and correctly call the car_wash_service () function. 1. Set the base car wash price to $10. 2. A dictionary with each additional service and the corresponding cost has been provided. 3. Get the user input: 3.1. The service name has to match the key in the dictionary. 3.2. Two additional services can be selected. If the user does not need additional service, they can use a additional service. 4. Call the function to output all selected services along with the corresponding costs and then the total price for all car wash services. as an input to reject an
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Introduction to Coding
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education