Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this program, we ll start with the following pseudocode: Get service type from customer Print service type message Get amount paid from customer Print

For this program, well start with the following pseudocode:
Get service type from customer
Print service type message
Get amount paid from customer
Print amount paid message
Check Service Type
If service type is oil change:
set cost to 35.
calculate change from amount paid minus cost
if change is equal to or greater than 0:
a. print cost message
b. print change from amount paid message.
else the cost is less than 0:
a. print error message for insufficient funds for oil change.
Else if service type is tire rotation:
Set cost to 19
Repeat steps 1 through 4 in oil change using tire rotation cost instead.
Else if service type is car wash:
Set cost to 7
Repeat steps 1 through 4 in oil change using car wash cost instead.
Otherwise service type is invalid:
Print error message for not recognized service.
Your input prompt for the auto service should be as follows:
Enter desired auto service:
with the following message printed out with service_choice being the service from input:
You entered: {service_choice}
Your input prompt for how much the user is paying should be as follows:
How much are you paying?
with the following message printed out with paid_amount being the amount paid from input:
You have paid: $ {paid_amount}
Note: Both input prompts should end with a space and a newline character.
Each cost message will be in the following format with service being the specific auto service and the service cost being that services cost:
Cost of {service}: $ {service_cost}
Each change from amount paid message will be in the following format with change being the difference between the amount paid and the services cost and paid_amount being the amount paid:
You are getting $ {change} change back from your $ {paid_amount}
The error message for insufficient amount paid for a service is as follows with service choice being the auto service:
Error: Your paid amount is not sufficient for the {service_choice} service
The error message for an invalid service request is as follows:
Error: Requested service is not recognized
Example Runs:
Enter desired auto service:
oil change
You entered: oil change
How much are you paying?
41
You have paid: $ 41
Cost of oil change: $ 35
You are getting $ 6 change back from your $ 41
Enter desired auto service:
tire change
You entered: tire change
How much are you paying?
15
You have paid: $ 15
Error: Requested service is not recognized
Enter desired auto service:
car wash
You entered: car wash
How much are you paying?
5
You have paid: $ 5
Error: Your paid amount is not sufficient for the car wash servi

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

More Books

Students also viewed these Databases questions

Question

5. Describe how contexts affect listening

Answered: 1 week ago