English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

start
read customerRecord
if quantityOrdered > 100 then
discount = .20
else
if quantityOrdered > 12 then
discount = .10
endif
endif
total = priceEach * quantityOrdered
total = total – discount * total
print total
return

this is the way i done it:

start
read customerRecord
perform discount ()
perform calculation ()
stop
perform discount ()
if quantityOrdered > 100 then
discount = .20
else
if quantityOrdered > 12 then
discount = .10
endif
endif
perform calculation ()
total = priceEach * quantityOrdered
total = total – discount * total
print total
return

IS IT RIGHT?

2007-10-09 06:46:15 · 2 answers · asked by caleb 1 in Computers & Internet Programming & Design

2 answers

Hope this is more like what you require.

start
read customerRecord
perform calculation (customerRecord)
stop
function discount (quantityOrdered)
discount = 0
if quantityOrdered > 100 then
discount = .20
else if quantityOrdered > 12 then
discount = .10
endif
return discount
end function
procedure calculation (customerRecord)
total = priceEach * quantityOrdered in customerRecord
total = total – discount(quantityOrdered) * total
print total
end procedure

2007-10-16 01:47:09 · answer #1 · answered by Anonymous · 0 0

NO.
I would re-read a couple of your previous examples if I were you. You have already provided examples of a more correct solution in your questions.

2007-10-09 15:16:17 · answer #2 · answered by AnalProgrammer 7 · 0 0

fedest.com, questions and answers