Computer Programming Algorithm Help?

Can someone show me how to set up this algorithm? It doesn’t seem hard, I just don’t know where to start that’s all.
Design 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 and Discount rate:
H = 50%
F = 40%
F = 33%
Q = 25%
Z = 0%
If the pricing code is Z, the words ‘No discount’ are to be printed on the screen. If the pricing code is not H, F, T, Q, or Z, the words ‘invalid pricing code are to be printed.
Can someone help me out? This would be appreciated! 5 stars best answer!

Both comments and pings are currently closed.

One Response to “Computer Programming Algorithm Help?”

  1. Zarn says:

    * There’s an error in your question. F was mentioned twice in your list of discounts. There’s an ambiguity too – it’s not stated whether Z will trigger the “No discount” ONLY, or display a set of prices as well. I’m going for the former.
    1: Input (price_article)
    2: Input (price_code)
    3: If (price_code) NOT IN {F, H, Q, T, Z} print ‘invalid pricing code’ => goto end
    4: If (price_code) == {Z} print ‘No discount’ => goto end
    5: case (price_code):
    5.1 H: print(price_article), print (price_article * 0.5), print (price_article * (1 – 0.5))
    5.2 F: print(price_article), print (price_article * 0.4), print (price_article * (1 – 0.4))
    5.3 T: print(price_article), print (price_article * 0.33), print (price_article * (1 – 0.33))
    5.4 Q: print(price_article), print (price_article * 0.25), print (price_article * (1 – 0.25))
    end

Powered by WordPress | Designed by: free css template | Thanks to hostgator coupon and web hosting reviews