Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

an-introduction-to-programming-with-cpp-8th-edition.pdf-Adobe Acrobat Reader DC

ID: 3689243 • Letter: A

Question

an-introduction-to-programming-with-cpp-8th-edition.pdf-Adobe Acrobat Reader DC File Edit View Window Help Sign In Home ools an-introduction-to-... × 22. A local department store wants a program that displays the number of reward points a customer earns each month. The reward points are based on the customer's member- ship type and total monthly purchase amount, as shown in Figure 9-41. The program should use a separate function for each membership type. If necessary, create a new project named Advanced22 Project, and save it in the Cpp8Chap09 folder. Enter your C++ instructions into a source file named Advanced22.cpp. Also enter appropriate comments and any additional instructions required by the compiler. Display the reward points in fixed-point notation with no decimal places. Test the program appropriately ADVANCED S Export PDF Adobe Export PDF Convert PDF Files to Word or Excel Online Select PDF File an-introduct...-edition·pdf × Convert to Microsoft Word(.docx) Document Language English (U.S.) Change 325 Exercises Convert Total monthly embershi Standard eward poin 5% of the total monthly purchase 7.5% of the total monthly purchase 10% of the total monthly purchase Create PDF Less than 75 75-149.99 150 and over Edit PDF Less than 150 150 and over 6% of the total monthly purchase 13% of the total monthly purchase uS Comment Premium Less than 200 200 and over 4% of the total monthly purchase 15% of the total monthly purchase Store and share files in the Document Cloud Figure 9-41 Learn More 8:28 PM 4/13/2016 Ask me anything

Explanation / Answer

/** C++ code to calculate reward points for various membership types **/

#include <iostream>
#include <cstdlib>
#include <string>
#include <fstream>
#include <iomanip>

using namespace std;


int standard_type (double monthly_purchase)
{
if(monthly_purchase < 75)
return monthly_purchase*0.05;

if(monthly_purchase >= 75 && monthly_purchase < 149.99)
return monthly_purchase*0.075;

if(monthly_purchase >= 150)
return monthly_purchase*0.10;
}

int plus_type (double monthly_purchase)
{
if(monthly_purchase < 150)
return monthly_purchase*0.06;

if(monthly_purchase >= 150)
return monthly_purchase*0.13;
}

int premium_type (double monthly_purchase)
{
if(monthly_purchase < 200)
return monthly_purchase*0.04;

if(monthly_purchase >= 200)
return monthly_purchase*0.15;
}

int main()
{
double monthly_purchase;
int choice;

cout << "Membership choices ";
cout << "1. Standard 2. Plus 3. Premium ";
cout << "Enter the choice for Membership type: ";
cin >> choice;

cout << "Enter the Total monthly purchase amount: ";
cin >> monthly_purchase;

int reward_points;
if(choice == 1)
reward_points = standard_type(monthly_purchase);
else if(choice == 2)
reward_points = plus_type(monthly_purchase);
else if(choice == 3)
reward_points = premium_type(monthly_purchase);
else
cout <<"Invalid choice ";

cout << "Reward Points: " << reward_points <<endl;

return 0;

}