Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Someone helped me and code this progeam but still my professor says There is nothing in your code indicating that the reward points will display

Someone helped me and code this progeam but still my professor says There is nothing in your code indicating that the reward points will display with fixed point notation with no decimal places .Please help me to fix it

Here is code:

#include #include using namespace std; //Function prototypes void standard(double purchaseAmt); void plusMemberShip(double purchaseAmt); void premium(double purchaseAmt); //Program begins with a main function int main() { //Declare variables char membershipType; double purchaseAmt = 0.0; //Prompt and read the membership type cout << "Membership types: " << endl; cout << " Standard = S " << endl; cout << " Plus = P " << endl; cout << " Premium = R " << endl; cout << "Enter membership type(S/P/R): "; cin >> membershipType; //Prompt and read the total monthly purchase amount cout << "Enter total monthly purchase amount: "; cin >> purchaseAmt; // fixed point notation with no decimal places cout << std::fixed; cout << std::setprecision(0); // zero means no decimal places if (membershipType == 'S' || membershipType == 's') { //function calls standard(purchaseAmt); } else if (membershipType == 'P' || membershipType == 'p') { plusMemberShip(purchaseAmt); } else if (membershipType == 'R' || membershipType == 'r') { premium(purchaseAmt); } else cout << " Invalid member ship type" << endl; cout << endl; //Pause the system for a while system("pause"); return 0; } double rewardPoints = 0; //Method definition of standard void standard(double purchaseAmt) { if (purchaseAmt < 75) rewardPoints = 0.05 * purchaseAmt; else if (purchaseAmt >= 75 && purchaseAmt <= 149.99) rewardPoints = 0.075 * purchaseAmt; else (purchaseAmt >= 150); rewardPoints = 0.10 * purchaseAmt; cout << " Reward points in Standard membership: " << rewardPoints << endl; } //Method definition of plusMemberShip void plusMemberShip(double purchaseAmt) { if (purchaseAmt < 150) rewardPoints = 0.06 * purchaseAmt; else rewardPoints = 0.13 * purchaseAmt; cout << " Reward points in plus membership: " << rewardPoints << endl; } //Method definition of premium void premium(double purchaseAmt) { if (purchaseAmt < 200) rewardPoints = 0.04 * purchaseAmt; else rewardPoints = 0.15 * purchaseAmt; cout << " Reward points in premium membership: " << rewardPoints << endl; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

More Books

Students also viewed these Databases questions