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).
#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;
}
Comments
Leave a comment