20*1.05 = 21
or do it the hard way
20*1 + .05*20 = 20 + 1 = 21
note use of distributive property to do it fast.
Write pseudocode for a program that calculates a customer’s total price after tax. The program will ask the user for the price of the item they are buying. Then the program will add a 5% tax to the item and output the final price. So if I tell the program my item costs $20.00 the output will be: Your total after tax is $21.00
3 answers
I know how to add the sales tax I just need help with the pseudocode part
This is what I have so far:
Modular Pseudocode
Main Module
Declare firstNum as int
Declare secondNum as float
Declare sum as char
Call User Input Module
Call Calculations Module
Call Output Module
Welcome Module
Write “Simple Multiplication”
Write “Give me two numbers and I will multiply them!”
Write “Simple Addition”
Write “Give me two numbers and I will add them!”
User Input Module
Write “Please enter your first number.”
Input 20
Write “Please enter your second number.”
Input .05
Calculation Mode
Set secondNum = 20 x .05
Set sum = 20 + 1
Output Module
Write 20 + “plus” + 1 + “equals” + 21
Modular Pseudocode
Main Module
Declare firstNum as int
Declare secondNum as float
Declare sum as char
Call User Input Module
Call Calculations Module
Call Output Module
Welcome Module
Write “Simple Multiplication”
Write “Give me two numbers and I will multiply them!”
Write “Simple Addition”
Write “Give me two numbers and I will add them!”
User Input Module
Write “Please enter your first number.”
Input 20
Write “Please enter your second number.”
Input .05
Calculation Mode
Set secondNum = 20 x .05
Set sum = 20 + 1
Output Module
Write 20 + “plus” + 1 + “equals” + 21