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: 3693267 • 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.

Please advise my program doesn't calculate

#include <iostream>
#include <iomanip>
using namespace std;

//function prototype
void rewardPointsST(double &total);
void rewardPointsPL(double &total);
void rewardPointsPM(double &total);
int main()
{
   // Declare variables
   char memberType = ' ';
   double monthlyPurchase = 0.0;
   double rewardPoints = 0.0;
  

   cout << "Standard = 'S'" << endl << "Plus= 'P'" << endl << "Premium= 'M'" << endl << "Enter Member Type: " << endl;
   cin >> memberType;

   // valid your membership

   while (toupper(memberType) != 'S' && toupper(memberType) != 'P' && toupper(memberType) != 'M')

   {
       cout << " Invalid member type! Guess again:" << endl;
       cin >> memberType;
   }
   cout << "Please enter your monthly purchase: " << endl;
   cin >> monthlyPurchase;
   cout << fixed << setprecision(0);
  
   if (toupper(memberType) == 'S')
   {
        rewardPointsST(monthlyPurchase);
       cout << " Monthly purchase $ " << monthlyPurchase << " accumalated " << rewardPoints << " points" << endl;

   }
   if (toupper(memberType) == 'P')
   {
       rewardPointsPL(monthlyPurchase);
       cout << " Monthly purchase $ " << monthlyPurchase << " accumalated " << rewardPoints << " points" << endl;

   }
   if (toupper(memberType) == 'M')
   {
       rewardPointsPM(monthlyPurchase);
       cout << " Monthly purchase $ " << monthlyPurchase << " accumalated " << rewardPoints << " points" << endl;

   }

  
   system("Pause");
   return 0;
   }
//end main function

//*****Function Definitions*****
void rewardPointsST(double &total)
{
   double rewardPoints = 0.0;
  
   if (total < 75 && total >= 0)
   {
       rewardPoints = total * .05;
   }
   else if (total >= 75 && total <= 149.99)
   {
       rewardPoints = total * .075;
   }
   else if (total >= 150)
   {
       rewardPoints = total * .1;
   }
   else
       cout << "Wrong entry please put valid input";
  
}
//end Standard type function


void rewardPointsPL(double &total)
{
   double rewardPoints = 0.0;

   if (total < 150 && total >= 0)
   {
       rewardPoints = total * .06;

   }
   else if (total >= 150)
   {
       rewardPoints = total * .13;

   }
   else
       cout << "Wrong entry please put valid input";
  
}
//end Plus type function

void rewardPointsPM(double &total)

{
   double rewardPoints = 0.0;
  
   if (total < 200 && total >= 0)
   {
       rewardPoints = total * .04;

   }
   else if (total >= 200)
   {
       rewardPoints = total * .15;

   }
   else
       cout << " Wrong entry please put valid input";

}
//end Premium type function

Explanation / Answer

#include <iostream>
#include <iomanip>
using namespace std;
//function prototype
int rewardPointsST(double &total);
int rewardPointsPL(double &total);
int rewardPointsPM(double &total);
int main()
{
// Declare variables
char memberType = ' ';
double monthlyPurchase = 0.0;
double rewardPoints = 0.0;
  
cout << "Standard = 'S'" << endl << "Plus= 'P'" << endl << "Premium= 'M'" << endl << "Enter Member Type: " << endl;
cin >> memberType;
// valid your membership
while (toupper(memberType) != 'S' && toupper(memberType) != 'P' && toupper(memberType) != 'M')
{
cout << " Invalid member type! Guess again:" << endl;
cin >> memberType;
}
cout << "Please enter your monthly purchase: " << endl;
cin >> monthlyPurchase;
cout << fixed << setprecision(0);
  
if (toupper(memberType) == 'S')
{
rewardPoints = rewardPointsST(monthlyPurchase);
cout << " Monthly purchase $ " << monthlyPurchase << " accumalated " << rewardPoints << " points" << endl;
}
if (toupper(memberType) == 'P')
{
rewardPoints = rewardPointsPL(monthlyPurchase);
cout << " Monthly purchase $ " << monthlyPurchase << " accumalated " << rewardPoints << " points" << endl;
}
if (toupper(memberType) == 'M')
{
rewardPoints = rewardPointsPM(monthlyPurchase);
cout << " Monthly purchase $ " << monthlyPurchase << " accumalated " << rewardPoints << " points" << endl;
}
  
system("Pause");
return 0;
}
//end main function
//*****Function Definitions*****
int rewardPointsST(double &total)
{
double rewardPoints = 0.0;
  
if (total < 75 && total >= 0)
{
rewardPoints = total * .05;
return rewardPoints;
}
else if (total >= 75 && total <= 149.99)
{
rewardPoints = total * .075;
return rewardPoints;
}
else if (total >= 150)
{
rewardPoints = total * .1;
return rewardPoints;
}
else
cout << "Wrong entry please put valid input";
  
return 0;
  
}
//end Standard type function

int rewardPointsPL(double &total)
{
double rewardPoints = 0.0;
if (total < 150 && total >= 0)
{
rewardPoints = total * .06;
return rewardPoints;
}
else if (total >= 150)
{
rewardPoints = total * .13;
return rewardPoints;
}
else
cout << "Wrong entry please put valid input";
  
return 0;
  
}
//end Plus type function
int rewardPointsPM(double &total)
{
double rewardPoints = 0.0;
  
if (total < 200 && total >= 0)
{
rewardPoints = total * .04;
return rewardPoints;
}
else if (total >= 200)
{
rewardPoints = total * .15;
return rewardPoints;
}
else
cout << " Wrong entry please put valid input";
  
return 0;
}
//end Premium type function

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