Answer to Question #248518 in C++ for Sarang

Question #248518

Create a C++ Program that will identify the Discount Rate of a shopper based on issued loyalty card, take the following conditions:

Loyalty Card TypeDiscount (%)(1) Frequent Buyer10%(2) One Time Buyer0%(3) Senior Citizen15%

This should be the outcome if ever we run the program

Example:

Total Purchase Cost: Php 3000.00

Loyalty Card Type: 1

Discounted Cost: Php 2700.00

1
Expert's answer
2021-10-08T04:35:14-0400
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;



int main()
{
  double decimalPart;
  string result;
  int Loyalty;
  cout<<"Total Purchase Cost: Php ";
  cin >> decimalPart;
  cout<<"Loyalty Card Type: ";
  cin >> Loyalty;
  if (Loyalty == 1) {
    cout << "Discounted Cost: Php " << decimalPart*0.9 << endl;
  } 
  else if (Loyalty == 2) {
    cout << "Discounted Cost: Php " << decimalPart << endl;
   } 
  else {
    cout << "Discounted Cost: Php " << decimalPart*0.85 << 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
APPROVED BY CLIENTS