(1) Prompt the user for an automobile service. Output the user's input. Ex: Enter desired auto service: Oil change You entered: Oil change (2) Output the price of the requested service. Ex: Enter desired auto service: Oil change You entered: Oil change Cost of oil change: $35 The program should support the following services (all integers): • Oil change - $35 • Tire rotation -- $19 • Car wash -- $7 If the user enters a service that is not listed above, then output the following error message: Error: Requested service is not recognized
Operations
In mathematics and computer science, an operation is an event that is carried out to satisfy a given task. Basic operations of a computer system are input, processing, output, storage, and control.
Basic Operators
An operator is a symbol that indicates an operation to be performed. We are familiar with operators in mathematics; operators used in computer programming are—in many ways—similar to mathematical operators.
Division Operator
We all learnt about division—and the division operator—in school. You probably know of both these symbols as representing division:
Modulus Operator
Modulus can be represented either as (mod or modulo) in computing operation. Modulus comes under arithmetic operations. Any number or variable which produces absolute value is modulus functionality. Magnitude of any function is totally changed by modulo operator as it changes even negative value to positive.
Operators
In the realm of programming, operators refer to the symbols that perform some function. They are tasked with instructing the compiler on the type of action that needs to be performed on the values passed as operands. Operators can be used in mathematical formulas and equations. In programming languages like Python, C, and Java, a variety of operators are defined.
I need help with this problem. Program is Python.
Here is an algorithm that describes the code:
1. Define a dictionary called service_prices that maps each service to its corresponding price.
2. Prompt the user to enter a desired auto service.
3. Read the user's input and store it in the variable called service.
4. Convert the user's input to lowercase using the lower() method.
5. Check if the lowercase service string is a key in the service_prices dictionary.
6. If the service is recognized (i.e., the service string is a key in the dictionary), do the following:
a. Output a message that includes the user's input.
b. Look up the price of the service from the service_prices dictionary and output a message that includes the price.
7. If the service is not recognized, output an error message.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images