Exercises (algorithm of discounting)

This is one example that I took from http://xover4.jkt.3d.x.indowebster.com/download/51/42b182384731a41bffceb903334d20d8.pdf
page 28, about the algorithm of discounting

Algorithm Giving Discounts
{inputted total shopping purchases. 10% discount is given provided that the total expenditure of at least 100,000, -. Algorithms provide the amount of output obtained and the total discount to be paid by the buyer.}
shopping: integer
discounts, total: real
read (shopping)
discount <- 0 {initialization}
if spending> = 100000 then
discount <- 0.1*shopping
end if
total of  <- shopping – discount
write (discount, total)
above algorithm can be described by the flowchart below :
The following output comes out if we are spending a total of 25 000 or less than 100 000
while the flowchart below, is the output that comes out of the expenditure is greater than or equal to 100 000

~ by nuryanisofia on April 16, 2012.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: