Knowee
Questions
Features
Study Tools

Discount Calculator:Build a program that calculates the discounted price of an item based on the original price and a discount percentage. If the original price is greater than 1000, apply a 10% discount; otherwise, apply a 5% discount.

Question

Discount Calculator:Build a program that calculates the discounted price of an item based on the original price and a discount percentage. If the original price is greater than 1000, apply a 10% discount; otherwise, apply a 5% discount.

🧐 Not the exact question you are looking for?Go ask a question

Solution

Sure, here is a simple Python program that calculates the discounted price of an item based on the original price and a discount percentage.

def calculate_discounted_price(original_price):
    if original_price > 1000:
        discount = 0.10
    else:
        discount = 0.05

    discounted_price = original_price - (original_price * discount)
    return discounted_price

# Test the function
original_price = float(input("Enter the original price: "))
print("The discounted price is: ", calculate_discounted_price(original_price))

This program first defines a function calculate_discounted_price that takes the original price as an argument. It then checks if the original price is greater than 1000. If it is, it sets the discount to 10% (or 0.10). If it's not, it sets the discount to 5% (or 0.05).

The function then calculates the discounted price by subtracting the discount from the original price. It returns this discounted price.

Finally, the program prompts the user to enter the original price, and it prints out the discounted price.

This problem has been solved

Similar Questions

Write a program in Java using a method Discount( ), to calculate a single discount or a successive discount. Use overload methods Discount(int), Discount(int,int) and Discount(int,int,int) to calculate single discount and successive discount respectively. Calculate and display the amount to be paid by the customer after getting discounts on the printed price of an article.

Given an order amount, write an R script that applies a 10% discount if the order amount is more than $20. Print the final amount after discount, or the original amount if no discount is applied.

​A tablet computer that usually sells for $599 was advertised with a saving of $148.Calculate the percentage discount being offered. Round to the nearest per cent.Percentage discount = %

What discount can a retailer offer on her marked price of $100 so that she ends up selling at no profit and no loss, if she had initially marked her goods up by $50?Discount = %

A trader gives successive discounts of 10%, 20% and 10% respectively. The percentage of the original cost price he will recover is:

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.