Answer to Question #281471 in Algorithms for John

Question #281471

While purchasing certain items, discount is offered based on the below conditions. If quantity and price per item are input through the keyboard, write a pseudo code and draw a flowchart to calculate the total expenses.

Purchase of item above or equal to 6000 – 15 % discount Purchase of item between 5000 and 5999 - 12 % discount Purchase of item between 4000 and 4999 - 08 % discount Purchase of item less than 4000 – 03 % discount


1
Expert's answer
2021-12-20T09:57:13-0500


pseudo code


Declare Integer quantity
Declare Real price
Declare Real totalExpenses
Declare Real discount


Display "Enter price of the item: "
Input price
Display "Enter the quantity of the item: "
Input quantity
Set totalExpenses = price * quantity
If totalExpenses >= 6000 Then
    Set discount = 0.15 * totalExpenses
Else
    If totalExpenses >= 5000 AND totalExpenses < 6000 Then
        Set discount = 0.12 * totalExpenses
    Else
        If totalExpenses >= 4000 AND totalExpenses < 5000 Then
            Set discount = 0.08 * totalExpenses
        Else
            Set discount = 0.03 * totalExpenses
        End If
    End If
End If
Set totalExpenses = totalExpenses - discount
Display "The total expenses: ", totalExpenses




FlowChart




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS