A local restaurant is implementing their marketing strategy to attract kids unde
ID: 3665728 • Letter: A
Question
A local restaurant is implementing their marketing strategy to attract kids under 12 (including 12 years) and seniors over 65 (including 65 years) by giving each person in these groups 10% discount. Write the pseudocode using "if" statements. Include declaration statements; declare variables for all given values; and use only variables in your “if” statement. Assume the cost prior to your code is calculated and assigned to a variable named priorCost; and the new cost with variable name newCost is calculated by multiplying priorCost by current discount with variable name currentDiscount. Write the pseudocode for the “if” statement that has age comparison, currentDiscount assignment, calculation of newCost.
Explanation / Answer
Pseudo -Code for discount calculation
START
DECLARE age as INTEGER
DECLARE priorCost as DOUBLE
DECLARE newCost as DOUBLE
INITLIAZE currentDiscout as DOUBLE as 0.10
PROMPT to enter cost of ITEM
READ priorCost
PROMPT to enter age value
READ age
IF age<=12
CALCULATE newCost=priorCost-priorCost*currentDiscount
ELSE IF age>=65
CALCULATE newCost=priorCost-priorCost*currentDiscount
ENDIF
PRINT "COST ",priorCost
PRINT "AFTER DISCOUNT", newCost
END
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.