Jason typically uses the Internet to buy various items. If the total cost of the items ordered, at
one time, is $200 or more, then the shipping and handling is free; otherwise, the shipping and
handling is $10 per item. Write a program that prompts Jason to enter the number of items
ordered and the price of each item. The program then outputs the total billing amount. You
have to use a loop (repetition structure) to get the price of each item. (For simplicity, you may
assume that Jason orders no more than nine (9) items at a time.)
#include <iostream>
using namespace std;
int main()
{
int noItem,itemPrice, amount, c;
while(noItem<9)
{
cout<<"Enter the number of item: ";
cin>>noItem;
cout<<"Enter the price of each Item $ ";
cin>>itemPrice;
}
amount=noItem*itemPrice;
if(amount>=200)
{
cout<<"The the shipping and handling is free!"<<endl;
cout<<"The total billing:$ "<<amount<<endl;
}
else
{
c=noItem*10;
amount+=c;
cout<<"The total billing:$ "<<amount<<endl;
}
return 0;
}
Comments
Thanku so much