I am trying to answer this problem: A local department store wants a program tha
ID: 3681333 • Letter: I
Question
I am trying to answer this problem:
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. 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 the code I am using, but it is not allowing me to enter anything beyond the monthly mount and does not calculate rewards. I think it may be an error with the declarations, but I am unsure.
#include <iostream>
#include <iomanip>
using namespace std;
void displayStandard(double totalBalance);
void displayPlus(double totalBalance);
void displayPremium(double totalBalance);
int main()
{
double balance = 0.0;
int points = 0;
cout << "Please enter your monthly balance: ";
cin >> balance;
displayStandard(points);
displayPlus(points);
displayPremium(points);
system("pause");
return 0;
}
int rewards = 0;
void displayStandard(double totalbalance)
{
if (totalBalance < 75)
rewards = .05 * totalBalance;
else if (totalBalance >= 75 & totalBalance <= 149.99)
rewards = .075 * totalBalance;
else (totalBalance >= 150);
rewards = .10 * totalBalance;
cout << "Reward points for standard: " << rewards;
// end if
}
void displayPlus(double totalBalance)
{
if (totalBalance < 150)
rewards = .06 * totalBalance;
else
rewards = .13 * totalBalance;
cout << "Reward points for standard: " << rewards;
}// end if
void displayPremium(double totalBalance)
{
if (totalBalance < 200)
rewards = .04 * totalBalance;
else
rewards = .15 * totalBalance;
cout << "Reward points for standard: " << rewards;
}// end if
Explanation / Answer
Program to display the reward points depending upon the type of memebership and the total purchase
#include <iostream>
#include <iomanip>
using namespace std;
void displayStandard(double totalBalance);
void displayPlus(double totalBalance);
void displayPremium(double totalBalance);
int main()
{
double totalBalance = 0.0;
int points = 0;
cout << "Please enter your monthly purchase: ";
cin >> totalBalance;
displayStandard(totalBalance);
displayPlus(totalBalance);
displayPremium(totalBalance);
return 0;
}
int rewards = 0;
void displayStandard(double totalBalance)
{
if (totalBalance < 75)
rewards = .05 * totalBalance;
else if (totalBalance >= 75 & totalBalance <= 149.99)
rewards = .075 * totalBalance;
else (totalBalance >= 150);
rewards = .10 * totalBalance;
cout << "Reward points for Standard: " << rewards<<" ";
// end if
}
void displayPlus(double totalBalance)
{
if (totalBalance < 150)
rewards = .06 * totalBalance;
else
rewards = .13 * totalBalance;
cout << "Reward points for Plus: " << rewards<<" ";
}// end if
void displayPremium(double totalBalance)
{
if (totalBalance < 200)
rewards = .04 * totalBalance;
else
rewards = .15 * totalBalance;
cout << "Reward points for Premium: " << rewards<<" ";
}// end if
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.