Created
December 1, 2020 23:57
-
-
Save mattsegura/90198a777f26731d74731135de714a03 to your computer and use it in GitHub Desktop.
BookPrice
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// book discounts | |
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
const double book_price = 5.00; | |
// Variables | |
int books, original_price; | |
cout << "\nEnter the amount of books sold: "; | |
cin >> books; | |
original_price = book_price * books; | |
if (original_price >= 0 && original_price <= 4) | |
{ | |
cout << "Total cost for " << books | |
<< " books = $" << | |
(original_price - (original_price * .2)) << endl; // 5 percent | |
} | |
else if (original_price >= 5 && original_price <= 9) | |
{ | |
cout << "THe total cost for " << books | |
<< " books = $" << | |
(original_price - (original_price * .2)) << endl; | |
} | |
else if (original_price >= 10 && original_price <= 14) | |
{ | |
cout << "THe total cost for " << books | |
<< " books = $" << | |
(original_price - (original_price * .3)) << endl; | |
} | |
else if (original_price >= 15 ) | |
{ | |
cout << "THe total cost for " << books | |
<< " books = $" << | |
(original_price - (original_price * .3)) << endl; | |
} | |
else | |
{ | |
cout << "Wrong program.\n" | |
<< "Input a number bigger than 0" | |
<< endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment