23.8k views
0 votes
Create a pseudocode showing logic steps to perform the required task below.

Write a program that reads the subtotal and the gratuity rate for a service. Compute the gratuity and the total. For example, if the user enters 10 for the subtotal and 15% as the gratuity rate, the program displays $1.5 as the gratuity and $11.5 as total. Your program should output and identify the subtotal entered, the gratuity rate, the gratuity amount and the total amount due

User Brobes
by
6.5k points

1 Answer

6 votes

Answer:

#Function for the calculcations needed

function subtotal_gratuity_total(subtotal,gratuity_rate):

gratuity_rate = gratuity_rate/100 #this is assuming the user enters the gratuity as a percentage value (e.g. 15)

gratuity = subtotal*gratuity_rate

total = subtotal+gratuity

return subtotal, gratuity_rate, gratuity, total

#Reading the values the user enters

Output(“Input subtotal”)

input (subtotal)

Output(“Input gratuity rate”)

input (gratuity_rate)

#Calling function we created with the values the user enters as inputs,

#and the 4 values required as outputs

subtotal,gratuity_rate,gratuity, total = subtotal_gratuity_total(subtotal,gratuity_rate)

User Michael Hegner
by
7.0k points