Answer to Question #224246 in C++ for Thato

Question #224246

3. A florist wants to send coupons to her 420 regular customers based on the number of orders the customer placed during the past year. The amount on the coupon depends on the number of orders according to the following table:

 Number of Orders

  Amount on Coupon

 2 - 6

7 -15

16-30  The number of orders times R14

The number of orders times R10 The number of orders times R11.50

  31 or more

The number of orders times R17

 The user is asked to enter the name of the customer and the number of orders placed. Determine the value of the customer’s coupon and then display the following


message on the screen (in the example the test data name is Carol and the coupon is worth R50).

  


1
Expert's answer
2021-08-09T02:35:26-0400
#include<iostream>
#include<bits/stdc++.h>
using namespace std;


int main()
{
	cout<<"Enter name of customer : ";
	string name;
	cin>>name;
	
	cout<<"Enter number of orders placed : ";
	int order;
	cin>>order;
	
	int coupon;
	if(order >= 2 && order <= 6)
	{
		coupon = order*14;
	}
	else if(order >= 7 && order <=15)
	{
		coupon = order*10;
	}
	else if(order>=16 && order<=30)
	{
		coupon = order*(11.5);
	}
	else{
		coupon = order*17;
	}
	
	cout<<"Coupon applied is of Rs. "<<coupon<<endl;
	
	
}





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