A software company sells a package that retails for $99. Quantity

discounts are given below:
Quantity Discount
10–19 20%
20–49 30%
50–99 40%
100 or more 50%
Design a program that asks the user to enter the number of packages purchased. The program should then display the amount of the discount (if any) and the total amount of the purchase after the discount.

Here is a Python program that implements the described functionality:

```python
def get_discount_rate(num_packages):
if 10 <= num_packages < 20:
return 0.2
elif 20 <= num_packages < 49:
return 0.3
elif 50 <= num_packages < 99:
return 0.4
elif num_packages >= 100:
return 0.5
else:
return 0

def calculate_discount(num_packages, retail_price):
discount_rate = get_discount_rate(num_packages)
discount = retail_price * num_packages * discount_rate
return discount

def calculate_total(num_packages, retail_price):
discount = calculate_discount(num_packages, retail_price)
total = retail_price * num_packages - discount
return total

if __name__ == "__main__":
retail_price = 99

num_packages = int(input("Enter the number of packages purchased: "))
discount = calculate_discount(num_packages, retail_price)
total = calculate_total(num_packages, retail_price)

print(f"Discount: ${discount:.2f}")
print(f"Total amount: ${total:.2f}")
```

When the user runs this program, they will be prompted to enter the number of packages purchased. The program will then calculate the discount and total amount of the purchase, and display these values to the user.

Here's a step-by-step approach to designing the program:

1. Start by taking input from the user for the number of packages purchased.
2. Use conditional statements to determine the discount based on the quantity purchased. In this case, you'll use if-elif-else statements.
3. Calculate the discount amount based on the discount percentage obtained from the previous step.
4. Calculate the total amount after applying the discount. This can be done by subtracting the discount from the total retail price.
5. Display the discount amount and the total amount after the discount to the user.

Here's a sample code in Python to implement the above steps:

```python
# Step 1: Take user input for the number of packages purchased
num_of_packages = int(input("Enter the number of packages purchased: "))

# Step 2: Determine the discount based on the quantity purchased
if num_of_packages >= 10 and num_of_packages <= 19:
discount = 20
elif num_of_packages >= 20 and num_of_packages <= 49:
discount = 30
elif num_of_packages >= 50 and num_of_packages <= 99:
discount = 40
elif num_of_packages >= 100:
discount = 50
else:
discount = 0

# Step 3: Calculate the discount amount
discount_amount = num_of_packages * 99 * (discount / 100)

# Step 4: Calculate the total amount after applying the discount
total_amount = num_of_packages * 99 - discount_amount

# Step 5: Display the discount amount and the total amount after the discount
print("Discount amount:", discount_amount)
print("Total amount after discount:", total_amount)
```

Note that this code assumes the discount is applied to each package individually.

To design a program that calculates the discount and total amount of a purchase based on the quantity of packages, follow these steps:

1. Prompt the user to enter the number of packages purchased.
2. Read and store the user's input in a variable, let's call it "quantity."
3. Define the package's retail price as a constant, set to $99.
4. Calculate the discount percentage based on the quantity purchased using if-else statements or a switch case.
- If the quantity is between 10 and 19 (inclusive), set the discount percentage to 20%.
- If the quantity is between 20 and 49 (inclusive), set the discount percentage to 30%.
- If the quantity is between 50 and 99 (inclusive), set the discount percentage to 40%.
- If the quantity is 100 or more, set the discount percentage to 50%.
- If the quantity is less than 10, there is no discount.
5. Calculate the discount amount by multiplying the discount percentage by the retail price.
- discount = (discount_percentage / 100) * retail_price
6. Calculate the total amount after the discount by subtracting the discount amount from the total purchase price.
- total_amount = retail_price - discount
7. Display the discount amount and the total amount after the discount to the user.

Here is a Python code example that implements the program:

```python
# Step 1: Prompt the user for the number of packages purchased
quantity = int(input("Enter the number of packages purchased: "))

# Step 2: Define the package retail price
retail_price = 99

# Step 3: Calculate the discount percentage
if 10 <= quantity <= 19:
discount_percentage = 20
elif 20 <= quantity <= 49:
discount_percentage = 30
elif 50 <= quantity <= 99:
discount_percentage = 40
elif quantity >= 100:
discount_percentage = 50
else:
discount_percentage = 0

# Step 4: Calculate the discount amount
discount = (discount_percentage / 100) * retail_price

# Step 5: Calculate the total amount after the discount
total_amount = retail_price - discount

# Step 6: Display the discount amount and the total amount after the discount
print("Discount: $", discount)
print("Total amount after discount: $", total_amount)
```

By following these steps and coding the program, it will prompt the user for the quantity, calculate the discount and total amount, and display the results accordingly.