this all to be done in pseudo code. A. a program where the user enters the price
ID: 3742126 • Letter: T
Question
this all to be done in pseudo code.
A. a program where the user enters the price of a purchase and the program computes and outputs a 5% sales tax. Don’t forget the prompt!
B. A program for calculating the area in square feet. (User will input the height and the width in feet.)
C. A program that calculates the difference between two numbers. i.e. subtracts one from the other. Thus this might be a negative value.
D. A program that asks the user to enter home maintenance costs for each of the four seasons and returns the total yearly maintenance costs. (Separate prompt and input for each input value!)
Explanation / Answer
A.calculating sales tax for purchase
BEGIN
DECLARE price,tax,sales_tax AS INTEGER
INITIALIZE tax as 0.05
PROMPT "Enter the price of purchase" AND STORE IN price
sales_tax = price * tax
PRINT "The sales tax for purchase is " +sales_tax
END
B.calculate the area in square feets
BEGIN
DECLARE height,width,area AS INTEGER
PROMPT "Enter the height in feets" AND STORE IN height
PROMPT "Enter the width in feets" AND STORE IN width
area = height * width
PRINT "The area is " +area +"square feets"
END
C.calculate the difference between two numbers
BEGIN
DECLARE number1,number2,sub AS INTEGER
PROMPT "Enter the number1" AND STORE IN number1
PROMPT "Enter the number2" AND STORE IN number2
IF (number1 > number2)
sub = number2 - number1
ELSE
sub = number1 - number2
END IF
PRINT "The difference between two numbers " +sub
END
D. TO FIND THE YEARLY MAINTENANCE
BEGIN
DECLARE spring,summer,autumn,winter,total AS INTEGER
PROMPT "Enter the spring season maintenance cost" AND STORE IN spring
PROMPT "Enter the summer season maintenance cost" AND STORE IN summer
PROMPT "Enter the autumn season maintenance cost" AND STORE IN autumn
PROMPT "Enter the winter season maintenance cost" AND STORE IN winter
total = spring + summer + autumn + winter
PRINT "The total yearly maintenance costs is " +total
END
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.