Vous êtes sur la page 1sur 3

Question: Calculate the discounted price of an item purchased.

Customers receive a discount of 15% on an item if the purchased price


of the item is over $100. If the price is over $150 then a discount of 25%
is applied.
I P O
The price of the
purchased item.
Purchases item
>$100, then a 15%
discount
Purchased item
>$150, then a 25%
discount.
Total final cost of the
item purchased
(discounted price).

BEGIN
INPUT Price
IF Price >100
THEN DiscountPrice = Price (Price * 0.15)
ELSE
IF Price >150
THEN DiscountPrice = Price (Price * 0.25)
ELSE
DiscountPrice = Price
ENDIF
ENDIS
PRINT DiscountPrice
END

What is a Flowchart?
Flowchart is a pictorial or graphical method of describing an algorithm.

Terminal: start and finish
There should be only one line in or one
line out
Process: used to describe a process or
action
It contains one line in and one line out
Subprogram: process described by its own
flowchart to perform a particular task
Decision: it consists of one line coming in
at the top and two lines leaving it





Flowchart




BEGIN
INPUT PRICE
IF PRICE
>100
THEN DiscountPrice =
Price (Price * 0.15)
IF PRICE
>150
THEN
DiscountPrice =
Price (Price *
0.25)
THEN
DiscountPrice =
Price
END IF
DISPLAY
DiscountPrice
END

Vous aimerez peut-être aussi