Asked by Ethan
If-Elseif-Else Pseudocode and Flowchart
Scenario:
A store recently opened and offers different payment schemes. Mr. Serrano, the owner, wants a program for online shopping that will determine the total purchase of a customer based on their payment option.
Option 1: Cash – The customer will get a 10% discount
Option 2: Installment – The customer will have a 15% interest.
Option 3: Cash on Delivery (COD) – The customer needs
to pay 150 USD for the delivery fee.
Option 4: No payment selected – Please select payment option to process order.
How do I write this in Pseudocode and Flowchart?
Scenario:
A store recently opened and offers different payment schemes. Mr. Serrano, the owner, wants a program for online shopping that will determine the total purchase of a customer based on their payment option.
Option 1: Cash – The customer will get a 10% discount
Option 2: Installment – The customer will have a 15% interest.
Option 3: Cash on Delivery (COD) – The customer needs
to pay 150 USD for the delivery fee.
Option 4: No payment selected – Please select payment option to process order.
How do I write this in Pseudocode and Flowchart?
Answers
Answered by
oobleck
read amt
read opt
disc = interest = cod = 0
ok = 0
while (ok = 0)
if (opt = 1) {disc = 0.10 * amt ; ok = 1}
else if (opt = 2) {interest = 0.15 * amt ; ok = 1}
else if (opt = 3) {cod = 150 ; ok=1}
end while
charge = amt - disc + interest + cod
this will loop unless an option value of 1,2,3 is selected
read opt
disc = interest = cod = 0
ok = 0
while (ok = 0)
if (opt = 1) {disc = 0.10 * amt ; ok = 1}
else if (opt = 2) {interest = 0.15 * amt ; ok = 1}
else if (opt = 3) {cod = 150 ; ok=1}
end while
charge = amt - disc + interest + cod
this will loop unless an option value of 1,2,3 is selected
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.