# A software company sells a package that retails for \$99- Quantity disc.docx

3 Feb 2023
1 sur 2

### A software company sells a package that retails for \$99- Quantity disc.docx

• 1. A software company sells a package that retails for \$99. Quantity discounts are given according to the following table: Quantity Discount 10-19 20% 20-49 30% 50-99 40% 100 or more 50% Write a c++ program that asks for the number of units purchased and computes the total cost of the purchase. Solution #include <iostream> using namespace std; int main () { int units; float totalCost; cout << "Please enter the number of units purchased : "; cin >> units; if((units >= 10) && (units <= 19)){ totalCost = (99 * units) - ((99 * units * 20)/100); cout<<"Total Cost : " << totalCost; } else if((units >= 20) && (units <= 49)){ totalCost = (99 * units) - ((99 * units * 30)/100); cout<<"Total Cost : " << totalCost;
• 2. } else if((units >= 50) && (units <= 99)){ totalCost = (99 * units) - ((99 * units * 40)/100); cout<<"Total Cost : " << totalCost; } else if(units >= 100){ totalCost = (99 * units) - ((99 * units * 50)/100); cout<<"Total Cost : " << totalCost; } else{ totalCost = 99 * units; cout<<"Total Cost : " << totalCost; } return 0; }