Write a program that finds the discount percent based on a number of pounds you purchased, and calculates the total cost of candy for Halloween taking in account that in some cases the purchase is taxable, and in some cases not. TAX applied AFTER discount is taken.
The program reads the following input: number of pounds (integer), price per pound (float), tax (integer), and additional integer, tax_indicator, that could be only 1 or 0, where 1 indicates that purchase is TAXABLE, and 0 otherwise.
Use the table below to find the total cost of your purchase. The table shows the discount percent based on a number of pounds you purchased. The program prints the discount percent and the final cost of your purchase.
Number of pounds | Discount percent |
0 - 5 pounds | no discount |
6 - 10 | 10% discount |
11 and above pounds | 20% discount |
Example 1: Input: number of pounds = 7, price per pound = 3.99, TAX = 6, tax_indicator = 1
Output: $26.65
Explanation of the output: you bought 7 pounds, got 10% discount, the purchase is TAXABLE. Final price
is $26.65
Example 2: Input: number of pounds = 15, price per pound = 2.99, TAX = 7, tax_indicator = 0
Output: $35.88
Explanation of the output: you bought 15 pounds, got 20% discount, the purchase is NOT TAXABLE. Final
price is $35.88