Challenging Algorithm Design Question
Question (Algorithm Design - Flowchart and Pseudocode)
A shopping program is needed to calculate the total cost of a customer's order. The program should:
1. Ask the user to enter the number of items they want to purchase.
2. For each item, ask the user to enter:
- The item price.
- The quantity they wish to buy.
3. If the total quantity exceeds 10 items, apply a 10% discount to the total cost.
4. If the total cost exceeds 1000, apply an additional 5% discount to the total cost.
5. Display the total cost after discounts, and categorize the customer's purchase as follows:
- "Regular" if the final cost is below 500.
- "Premium" if the final cost is between 500 and 1000.
- "VIP" if the final cost is above 1000.
Requirements:
- Ensure input validation for item price and quantity (prices should be non-negative, and quantities
should be at least 1).
- Calculate the total cost, apply applicable discounts, and determine the category.
Tasks:
(a) Draw a flowchart to show this process.
(b) Write the pseudocode to represent this process.