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: 3689015 • 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. This is my code what's wrong with it??

//function prototype
double getRewardsPoints(double purchase, double rate);
int main()
{
//Initialize variables
   char type = ' ' ;
   double purchase = 0.0;
   double points = 0.0;

// Membership types
cout << " Membership type: " << endl;
cout << " Standard = S " << endl;
cout << " Plus = P " << endl;
cout << " Premium = M " << endl;
cout << " Type: ";
cin >> type;

// valid your membership
if (toupper(type) !='S' && toupper(type) !='P' && toupper(type) !='M')

{
   cout << " Invalid member type" << endl;
   return 0;

}
// Monthly purchase amount
cout << "Monthly purchase amount";
cin >> purchase;

// checking if purchase is valid
if (purchase < 0 )
{
   cout << "Error" << endl;
     
}
return 0;
// Determine amount of points
if (toupper(type)== 'S')
{
   if (purchase < 75)
       cout << " Points: " << getRewardsPoints(purchase, 0.05);
     
   else if (purchase >=75 && purchase < 150)
       cout << "Points: " << getRewardsPoints(purchase, 0.075);
   else
       cout << "Points: " << getRewardsPoints(purchase, 0.1);
}
else if (toupper(type)== 'P')
{
   if (purchase < 150)
       cout << "Points: " << getRewardsPoints(purchase, 0.06);
   else
       cout << "Points: " << getRewardsPoints(purchase, 0.13);
}
else if (toupper(type)== 'M')
{
   if (purchase < 200)
       cout << "Points: " << getRewardsPoints(purchase, 0.04);
   else
       cout << "Points: " << getRewardsPoints(purchase, 0.15);
}
// Display the amount of points

cout << fixed << setprecision (0);
cout << " Amount of points:" << points << endl;
system("pause");
return 0;
}
//function definitions
double getRewardsPoints(double purchase, double rate )
{
   double rewardsPoints = 0.0;
   rewardsPoints= purchase * rate;
   return rewardsPoints;
}
   // end of getRewardsPoints

Explanation / Answer

Please find below the corrected full code :

#include <iostream>
#include <string>
#include <iomanip>

using namespace std;
double getRewardsPoints(double purchase, double rate);
int main()
{
//Initialize variables
char type = ' ' ;
double purchase = 0.0;
double points = 0.0;
// Membership types
cout << " Membership type: " << endl;
cout << " Standard = S " << endl;
cout << " Plus = P " << endl;
cout << " Premium = M " << endl;
cout << " Type: ";
cin >> type;
// valid your membership
if (toupper(type) !='S' && toupper(type) !='P' && toupper(type) !='M')
{
cout << " Invalid member type" << endl;
return 0;
}
// Monthly purchase amount
cout << "Monthly purchase amount";
cin >> purchase;
// checking if purchase is valid
if (purchase < 0 )
{
cout << "Error" << endl;

}
return 0;
// Determine amount of points
if (toupper(type)== 'S')
{
if (purchase < 75)
cout << " Points: " << getRewardsPoints(purchase, 0.05);

else if (purchase >=75 && purchase < 150)
cout << "Points: " << getRewardsPoints(purchase, 0.075);
else
cout << "Points: " << getRewardsPoints(purchase, 0.1);
}
else if (toupper(type)== 'P')
{
if (purchase < 150)
cout << "Points: " << getRewardsPoints(purchase, 0.06);
else
cout << "Points: " << getRewardsPoints(purchase, 0.13);
}
else if (toupper(type)== 'M')
{
if (purchase < 200)
cout << "Points: " << getRewardsPoints(purchase, 0.04);
else
cout << "Points: " << getRewardsPoints(purchase, 0.15);
}
// Display the amount of points
cout << setprecision (0) << fixed ;
cout << " Amount of points:" << points << endl;
system("pause");
return 0;
}
//function definitions
double getRewardsPoints(double purchase, double rate )
{
double rewardsPoints = 0.0;
rewardsPoints= purchase * rate;
return rewardsPoints;
}
// end of getRewardsPoints

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