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

A local department store wants a program that displays the number of reward poin

ID: 3688790 • Letter: A

Question

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 membership type and total monthly purchase amount, as shown in Figure 6-45. If necessary, create a new project named Advanced18 Project, and save it in the Cpp8Chap06 folder. Enter your C++ instructions into a source file named Advanced18.cpp.The program should use a separate function for each membership. Also enter appropriate comments and any additional instructions required by the compiler. Display the reward points in fixed-point notation with no decimal places. Save, run, and test the program. Total monthly Membership type purchase ($) Reward points Standard Less than 75 5% of the total monthly purchase 75–149.99 7.5% of the total monthly purchase 150 and over 10% of the total monthly purchase Plus Less than 150 6% of the total monthly purchase 150 and over 13% of the total monthly purchase Premium Less than 200 4% of the total monthly purchase 200 and over 15% of the total monthly purchase

Explanation / Answer

Code:

#include <iostream>
using namespace std;


int calculateRewardsForStandard(int amount)
{
if(amount < 75)
return amount*0.05; // 5% of amount
else if(amount < 150)
return amount*0.075;//7.5% of amount
else
return amount*0.1;//10% of amount
}


int calculateRewardsForPlus(int amount)
{
if(amount < 150)
return amount * 0.06;//6% of amount
else
return amount*0.13;// 13% of amount
}


int calculateRewardsForPremium(int amount)
{
if(amount < 200)
return amount*0.04;
else
return amount*0.15;
}


int main()
{
int amount;
int choice;
int rewards;
while(1)
{
cout<<"enter the membership type"<<endl;
cout<<"1.Standard 2.Plus 3.Premium 4. Exit"<<endl;// read the membership type
cin>>choice;// read the membership type
cout<<choice<<endl;
if(choice==4)
break;
cout<<"enter this month purchase amount "<<endl;// read total monthly purchase
cin>>amount;
cout<<amount<<endl;
switch(choice)
{
case 1:
rewards=calculateRewardsForStandard(amount);
break;
case 2:
rewards=calculateRewardsForPlus(amount);
break;
case 3:
rewards=calculateRewardsForPremium(amount);
break;
  
default:
cout<<"enter a valid membership type"<<endl;
break;
  
}
cout<<"rewards got by this member for this month = "<<rewards<<endl;
  
}
}

#include <iostream>
using namespace std;


int calculateRewardsForStandard(int amount)
{
if(amount < 75)
return amount*0.05; // 5% of amount
else if(amount < 150)
return amount*0.075;//7.5% of amount
else
return amount*0.1;//10% of amount
}


int calculateRewardsForPlus(int amount)
{
if(amount < 150)
return amount * 0.06;//6% of amount
else
return amount*0.13;// 13% of amount
}


int calculateRewardsForPremium(int amount)
{
if(amount < 200)
return amount*0.04;
else
return amount*0.15;
}


int main()
{
int amount;
int choice;
int rewards;
while(1)
{
cout<<"enter the membership type"<<endl;
cout<<"1.Standard 2.Plus 3.Premium 4. Exit"<<endl;// read the membership type
cin>>choice;// read the membership type
cout<<choice<<endl;
if(choice==4)
break;
cout<<"enter this month purchase amount "<<endl;// read total monthly purchase
cin>>amount;
cout<<amount<<endl;
switch(choice)
{
case 1:
rewards=calculateRewardsForStandard(amount);
break;
case 2:
rewards=calculateRewardsForPlus(amount);
break;
case 3:
rewards=calculateRewardsForPremium(amount);
break;
  
default:
cout<<"enter a valid membership type"<<endl;
break;
  
}
cout<<"rewards got by this member for this month = "<<rewards<<endl;
  
}
}

Output:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote