Answer to Question #18007 in C++ for Candice Battle

Question #18007
Write a program that allows the user to input a total dollar amount for an
online shopping order and computes and outputs the shipping cost based
on the following schedule:
Order Total Ship within USA Ship to Canada
Less than $50.00 $6.00 $8.00
$50.01–$100.00 $9.00 $12.00
$100.01–$150.00 $12.00 $15.00
Over $150.00 Free Free
1
Expert's answer
2012-11-06T10:51:26-0500
#include <iostream>
using namespace std;
int main ()
{
inttotalCost;
cout<< "Enter total cost: $";
cin>> totalCost;

if(totalCost < 50) {
cout<< "Ship within USA: 6$" << endl;
cout<< "Ship to Canad: 8$" << endl;
}
elseif (totalCost > 50 && totalCost <= 100) {
cout<< "Ship within USA: 9$" << endl;
cout<< "Ship to Canad: 12$" << endl;
}
elseif (totalCost > 100 && totalCost < 150) {
cout<< "Ship within USA: 12$" << endl;
cout<< "Ship to Canad: 15$" << endl;
}
else if (totalCost > 150) {
cout<< "Ship within USA: FREE" << endl;
cout<< "Ship to Canad: FREE" << endl;
}
system("pause");
return0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS