0% found this document useful (0 votes)
1 views1 page

Challenging Algorithm Design Question

The document outlines a shopping program that calculates the total cost of a customer's order based on item prices and quantities. It includes conditions for applying discounts based on the total quantity and cost, and categorizes the final cost into 'Regular', 'Premium', or 'VIP'. Additionally, it emphasizes the need for input validation for item prices and quantities.

Uploaded by

goslinfredoxger
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views1 page

Challenging Algorithm Design Question

The document outlines a shopping program that calculates the total cost of a customer's order based on item prices and quantities. It includes conditions for applying discounts based on the total quantity and cost, and categorizes the final cost into 'Regular', 'Premium', or 'VIP'. Additionally, it emphasizes the need for input validation for item prices and quantities.

Uploaded by

goslinfredoxger
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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.

You might also like