Problem # 2
SM Supermalls is one of Southeast Asia's biggest developers and the operator of 72 malls in the Philippines. Create a C++ program that displays the number of rewards points an SM Mall customer earns each month. The rewards points should be based on membership type and total purchased amount each month. The output should be in a fixed point notation with no decimal places.
Membership Type
Advantage
Total Monthly Purchase
Less than 3750
3750 7499
7500 and over
Prestige
Less than 10,000
10,000 and over
Reward points
5% of the total monthly purchased
7.5% of the total monthly
10% of the total monthly
4% of the total monthly
15% of the total monthly
#include <iostream>
using namespace std;
int main() {
int type;
cout << "Enter membership Type:"<< endl;
cout << "1 - Advinced" << endl;
cout << "2 - Prestige" << endl;
cout << ">> ";
cin >> type;
int monthPurchas;
cout << "Enter Total Monthly Purchase: ";
cin >> monthPurchas;
int rewards;
if (type == 1) {
if (monthPurchas < 3750) {
rewards = static_cast<int>(monthPurchas * 0.05 + 0.5);
}
else if (monthPurchas < 7500) {
rewards = static_cast<int>(monthPurchas * 0.075 + 0.5);
}
else {
rewards = static_cast<int>(monthPurchas * 0.1 + 0.5);
}
}
else if (type == 2) {
if (monthPurchas < 10000) {
rewards = static_cast<int>(monthPurchas * 0.04 + 0.5);
}
else {
rewards = static_cast<int>(monthPurchas * 0.15 + 0.5);
}
}
else {
cout << "Incorrect membership type" << endl;
rewards = 0;
}
cout << "The rewards points are " << rewards << endl;
return 0;
}
Comments
Leave a comment