1. A software company sells a package that retails for $99. Quantity discounts are given according to the following table.
Quantity 10-19, 20-49 50-99 100 or more. discount 20% 30% 40% 50%
Write a program that asks for the number of units sold and computes the total cost of the purchase.
Input validation: Make sure the number of units is greater than 0.
Sample Output1:
How many units were sold? 0
Units sold must be greater than zero.
Write a program that asks for the number of units sold and computes the total cost of the purchase.
Input validation: Make sure the number of units is greater than 0.
Write a program to determine the price for a portrait sitting. The price is determined by subjects in portraits, background chosen and sitting appointment day. The fee schedule is shown below.
Fancy background and sitting appointment cost an extra 10 percent more than the base price.
1 $100 2 $130 3 $150 4 $160 5 or more $165
#include<iostream>
using namespace std;
int main()
{int number;
double cost,discount;
cout<<"Enter number of packages: ";
cin>>number;
while(number<=0)
{cout<<"Invalid entry.-must be >0\n";
cout<<"Enter number of packages: ";
cin>>number;
}
if(number>=100)
discount=50;
else if(number>=50)
discount=40;
else if(number>=20)
discount=30;
else if(number>=10)
discount=20;
else
discount=0;
cost=number*99;
cost=cost-(cost*(discount/100.));
cout<<"Total Cost: $"<<cost<<endl;
system("pause");
return 0;
}
Comments
Leave a comment