//Max Kichuk CS1A Chapter 4, P. 222, #11
//
/****************************************************************
*
* CALCULATES TOTAL POINTS REWARDED TO CUSTOMER
* ______________________________________________________________
* Asks the user to enter the number of books
* they purchases this month. Then displays
* the number of points they are awarded accordingly.
* ______________________________________________________________
*
* INPUT
* booksPurchased : number of books customer bought
*
* OUTPUT
* pointsRewarded : points according to number of books bought
*
**************************************************************/
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
//Declaring program variables
int booksPurchased; // INPUT - number of books purchased
int pointsRewarded; // OUTPUT - points for booksPurchased
// INPUT : Initialize variables
cout << "How many books did you purchase this month?: \n\n";
cin >> booksPurchased;
// OUTPUT : checks how many books were purchased and returns points
if (booksPurchased == 0)
{
cout << "You have purchased 0 books this month!\n";
cout << " 0 books: " << setw(10) << "0 points earned." << endl;
}
else if (booksPurchased == 1)
{
cout << "You have purchased 1 book this month!\n";
cout << " 1 book: " << setw(10) << "5 points earned." << endl;
}
else if (booksPurchased == 2)
{
cout << "You have purchased 2 books this month!\n";
cout << " 2 books: " << setw(10) << "15 points earned." << endl;
}
else if (booksPurchased == 3)
{
cout << "You have purchased 3 books this month!\n";
cout << " 3 books: " << setw(10) << "30 points earned." << endl;
}
else
{
cout << "You have purchased " << booksPurchased << " books this month!\n";
cout << " " << booksPurchased << " books: " << setw(10) << "60 points earned." << endl;
}
return 0;
}