Hello all I am taking an intro to programming class and need any help I can get this is one of the exercises that I have to to and my answer is at the bottom if anyone can tell me if at least if I'm going in the right direction I would appreciate it.
Rewrite the following pseudocode so the discount decisions and
calculations are in a module.
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
stop
This is what I came up with:
start
read customerRecord ()
if quantityOrdered > 100 then
discount =.20 ()
else
if quantityOrdered > 12 then
discount = .10 ()
end if
end if
total = priceEach * quantityOrdered()
total = total - discount * total ()
print total()
stop
I came up with this because from what I read a module is
just breaking down problems into smaller units. So that
the programmer can understand what the end results should
be.
If I am wrong please let me know.
blancanyc69 0 Newbie Poster
Rashakil Fol 978 Super Senior Demiposter Team Colleague
m.wangwe 0 Newbie Poster
Nick Evan 4,005 Industrious Poster Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.