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

Question #12023

how to compute the discount and and the total purchase and output them?

Expert's answer

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;

}

#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 orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment