Answer to Question #320723 in C++ for Please

Question #320723

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

1
Expert's answer
2022-03-30T07:39:14-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog