Answer to Question #12023 in C++ for billy gesmundo

Question #12023
how to compute the discount and and the total purchase and output them?
1
Expert's answer
2012-07-20T10:03:50-0400
Here is an example.

#include <iostream>
using namespace std;

int main(){
double order, discount, price = 99;;
// order discounts
cout << "Enter the quantity for your order";
cin >> order;
// determine discount
if ((order > 10) && (order < 19))
& discount = 20;
else if ( order > 49)
& discount = 30;
else if ( order > 99)
& discount = 40;
else if ( order < 100)
& discount = 50;
// show discount percentage
cout << " your discount on this purchase is" << discount << ".\n";
double total = price * order - discount;
cout << " purchase is" << total <<".\n";
return 0;
}


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
New on Blog
APPROVED BY CLIENTS