Question

In: Computer Science

Write the Pseudocode for the following programming problem. Write a program that will calculate a tip...

Write the Pseudocode for the following programming problem.

Write a program that will calculate a tip based on the meal price and a 6% tax on a meal price. The user will enter the meal price and the program will calculate tip, tax, and the total. The total is the meal price plus the tip plus the tax. Your program will then display the values of tip, tax, and total.

The tip amounts based on the mean price are as follows:

    

Meal Price Range

Tip Percent

.01 to 5.99

10%

6 to 12.00

13%

12.01 to 17.00

16%

17.01 to 25.00

19%

25.01 and more

22%

  

The Pseudocode

            TYPE PSEUDOCODE HERE

The Python Code for Reference

#the main function

def main():

    print 'Welcome to the tip and tax calculator program'

    print   #prints a blank line

    mealprice = input_meal()

    tip = calc_tip(mealprice)

    tax = calc_tax(mealprice)

    total = calc_total(mealprice, tip, tax)

    print_info(mealprice, tip, tax, total)

       

#this function will input meal price

def input_meal():

    mealprice = input('Enter the meal price $')

    mealprice = float(mealprice)

    return mealprice

#this function will calculate tip at 20%

def calc_tip(mealprice):

    if mealprice >= .01 and mealprice <= 5.99:

        tip = mealprice * .10

    elif mealprice >= 6 and mealprice <=12:

        tip = mealprice * .13

    elif mealprice >=12.01 and mealprice <=17:

        tip = mealprice * .16

    elif mealprice >= 17.01 and mealprice <=25:

        tip = mealprice * .19

    else:

        tip = mealprice * .22

    return tip

#this function will calculate tax at 6%

def calc_tax(mealprice):

    tax = mealprice * .06

    return tax

#this function will calculate tip, tax, and the total cost

def calc_total(mealprice, tip, tax):

    total = mealprice + tip + tax

    return total

#this function will print tip, tax, the mealprice, and the total

def print_info(mealprice, tip, tax, total):

    print 'The meal price is $', mealprice

    print 'The tip is $', tip

    print 'The tax is $', tax

    print 'The total is $', total

   

#calls main

main()

Solutions

Expert Solution

Here is the pseudo code for this code:

if the answer helped you please upvote and if you have any doubts please comment i will surely help.

Pseudocode:

Step 1: Take the price of the meal as input from the user and store it in a variable called "mealPrice".

Step 2: Calculate the tip, for the mealPrice and store it in a variable "tip"

Step 3: Calculate tip using the following conditions:
   if mealprice>=.01 and mealprice<=5.99:           tip = mealprice * .10

else if the mealprice>=6 and mealprice<=12:
       tip = mealprice * .13

elif mealprice >=12.01 and mealprice <=17:
       tip = mealprice * .16

elif mealprice >= 17.01 and mealprice <=25:
       tip = mealprice * .19

else:  
   tip = mealprice * .22

Step 4: Calculate the tax for the price and store it in a variable called "tax"

       tax = 0.06 * mealPrice

Step 5: Calculate the total cost
       total = mealprice + tip + tax

Step 6: Print all the infromation of the user.


Related Solutions

Write the Flowchart for the following programming problem based on the pseudocode below. Last year, a...
Write the Flowchart for the following programming problem based on the pseudocode below. Last year, a local college implemented rooftop gardens as a way to promote energy efficiency and save money. Write a program that will allow the user to enter the energy bills from January to December for the year prior to going green. Next, allow the user to enter the energy bills from January to December of the past year after going green. The program should calculate the...
write pseudocode not c program If- else programming exercises 1.    Write a C program to find...
write pseudocode not c program If- else programming exercises 1.    Write a C program to find maximum between two numbers. 2.    Write a C program to find maximum between three numbers. 3.    Write a C program to check whether a number is negative, positive or zero. 4.    Write a C program to check whether a number is divisible by 5 and 11 or not. 5.    Write a C program to check whether a number is even or odd. 6.    Write...
Write a program that will calculate a 15% tip and a 13% tax on a meal...
Write a program that will calculate a 15% tip and a 13% tax on a meal price. The user will enter the meal price and the program will calculate tip, tax, and the total. The total is the meal price plus the tip plus the tax. Your program will then display the values of tip, tax, and total. Please format the output, also the round up to 2 decimal places. Write the code in python.
Write a program that will calculate a 15% tip and a 13% tax on a meal...
Write a program that will calculate a 15% tip and a 13% tax on a meal price. The user will enter the meal price and the program will calculate tip, tax, and the total. The total is the meal price plus the tip plus the tax. Your program will then display the values of tip, tax, and total. Please format the output, also the round up to 2 decimal places.
C Program and pseudocode for this problem. Write a C program that plays the game of...
C Program and pseudocode for this problem. Write a C program that plays the game of "Guess the number" as the following: Your program choose the number to be guessed by selecting an integer at random in the rang of 1 to 1000. The program then asks the use to guess the number. If the player's guess is incorrect, your program should loop until the player finally gets the number right. Your program keeps telling the player "Too High" or...
6. Write a program in C programming (compile and run), a pseudocode, and draw a flowchart...
6. Write a program in C programming (compile and run), a pseudocode, and draw a flowchart for each of the following problems: a) Obtain three numbers from the keyboard, compute their product and display the result. b) Obtain two numbers from the keyboard, and determine and display which (if either) is the smaller of the two numbers. c) Obtain a series of positive numbers from the keyboard, and determine and display their average (with 4 decimal points). Assume that the...
write pseudocode for the following problems not c code Pseudocode only Write a C program to...
write pseudocode for the following problems not c code Pseudocode only Write a C program to print all natural numbers from 1 to n. - using while loop Write a C program to print all natural numbers in reverse (from n to 1). - using while loop Write a C program to print all alphabets from a to z. - using while loop Write a C program to print all even numbers between 1 to 100. - using while loop...
Write a C++ program for the following problem: Calculate and print the area and volume of...
Write a C++ program for the following problem: Calculate and print the area and volume of a cone inside a While  loop that goes from 1 to 20 with a step of .5. (the step is 1/2 or Point 5, so you go 10, 10.5,11, 11.5) Note: Your loop variable will need to be a double data type Use two decimal places on all numbers that are double data type. This will be a table with 3 columns. Don't worry about...
Write pseudocode (3 Marks) and program structure (4 Marks) for the problem given below; In a...
Write pseudocode and program structure (4 Marks) for the problem given below; In a college, students are awarded a pass grade if their total mark is between 50-59, credit grade if the mark is between 60-69, distinction for marks between 70-79. High distinction if the mark is above or equal to 80 and fail if the mark is below 50.
Please write variables and program plan(pseudocode) of this C++ programming code: #include <iostream> using namespace std;...
Please write variables and program plan(pseudocode) of this C++ programming code: #include <iostream> using namespace std; void leapYear(int x); int main() { int x; cout << "Enter a year: "; cin >> x; leapYear (x);   return 0; } void leapYear(int x ) {    if (x % 400 == 0)    {    cout << "This is a leap Year";}    else if    ((x % 4 == 0) && (x % 100 != 0))    {    cout <<...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT