You have been given an algorithm that will prompt a terminal operator for the price of an article and a pricing code. Your program is then to calculate a discount rate according to the pricing code and print to the screen the original price of the article, the discount amount and the new discounted price. Calculate the pricing code and accompanying discount amount as follows:
Pricing code
Discount rate
H
50%
F
40%
T
33%
Q
25%
Z
0%
If the pricing code is Z, then the words ‘No discount’ are to be printed on the screen. If the pricing code is not H, F, T, Q or Z then the words ‘Invalid pricing code’ are to be printed.
HERE IS THE PSEUDOCODE:
B Solution algorithm
Calculate_discounted_price
1 Prompt for price, pricing_code
2 Get price, pricing_code
3 set message to blank
4 set discount_amount, new_price to zero
5 CASE OF pricing_code
H : discount_amount = price * 0.5
F : discount_amount = price * 0.4
T : discount_amount = price * 0.33
Q : discount_amount = price * 0.25
Z : message = ‘No discount’
other: message = ‘Invalid pricing code’
ENDCASE
6 IF message = blank THEN
new_price = price - discount_amount
Display price, discount_amount, new_price
ELSE
Display price, pricing_code, message
ENDIF
END
I'm not sure if I start with DIM or what! PLEASE help!