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.

Recommended Answers

All 3 Replies

All you did is put parentheses after some things?

hi people can you help me with this question.You are required to write the pseudocode and draw its flowchart.
write and draw an algorithm to enter the marks of 20 students.

declare students[20]
declare counter

while counter < 20
read studentname and store in array
counter++

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.