In: Computer Science
c++ language, using Xcode
Suppose the membership at a fitness club is $500 for individual, $800 for couple and $1200 for 4 people. Every month, the manager at the club says that guests will get discounts for one service per month. He provides you with the list of services that will get a discount:
Your program will be reading in a file which contains a list of services at a fitness club. The discount is determined by the type of service. For example, the file is as follows:
Cafe: Smoothies
SPA: Hair and Skin
Training: 90 day challenge
Aquatics: Kids free training session
Your program should read this file and offer this discount:
If the service is Cafe, then discount is 1% of annual fitness club fee.
If the service is SPA, then discount is 10% of the annual fitness club fee.
If the service is Training, then discount is 15% of the annual fitness club fee.
If the service is Aquatics, then no discount, but program should only offer it for the family memberships.
Your program should ask the user what type of membership they have. Based on the type of membership, your program should calculate the dollar amount discount per service and list all applicable services and benefits for that user.
Your program should be reading the file in and calculating the benefits based on the type of membership. Your program should also randomly pick among the 4 discounts or 3 depending on the type of membership and display which discount the member gets for this month.
#include <iostream>
#include<bits/stdc++.h>
#include<string>
using namespace std;
float individual_price = 5000;
float couple_price = 8000;
float people_4_price = 12000;
float total_price_individual = 0;
float total_price_couple = 0;
float total_price_people_4 = 0;
int main()
{
// Initialize String Array
string services[4] = {"cafe", "spa", "training",
"aquatics"};
cout<<"Available
services"<<"\n";
// Print Strings
for (int i = 0; i < 4; i++)
cout <<
services[i] << "\n";
int service_choosen;
service_choosen = rand() %
3; // v1 in the
range 0 to 99
cout << service_choosen << "\n";
if (service_choosen == 0)
{
cout<<"you choose the service of Cafe :
Smoothies"<<"\n";
string str;
cout << "Please Enter Membership Type : \n";
getline (cin, str);
cout << "Hello,you choose " << str << "\n";
if (str == individual)
{
total_price_individual =
5000 + (5000*0.01);
cout <<"your total
cost for all services are : ";
cout <<
total_price_individual;
}
else if (str ==
couple)
{
total_price_couple =
8000 + (8000*0.1);
cout <<"your total
cost for all services are : ";
cout <<
total_price_couple;
}
else if (str ==
people_4)
{
total_price_people_4 =
12000 + (12000*0.15);
cout <<"your total
cost for all services are : ";
cout <<
total_price_people_4;
}
else
cout<<"you put wrong choice";
}
if (service_choosen == 1)
{
cout<<"you choose the service of spa : Hair and skin
"<<"\n";
string str;
cout << "Please Enter Membership Type : \n";
getline (cin, str);
cout << "Hello,you choose " << str << "\n";
if (str == individual)
{
total_price_individual =
5000 + (5000*0.01);
cout <<"your total
cost for all services are : ";
cout <<
total_price_individual;
}
else if (str ==
couple)
{
total_price_couple =
8000 + (8000*0.1);
cout <<"your total
cost for all services are : ";
cout <<
total_price_couple;
}
else if (str ==
people_4)
{
total_price_people_4 =
12000 + (12000*0.15);
cout <<"your total
cost for all services are : ";
cout <<
total_price_people_4;
}
else
cout<<"you put wrong choice";
}
if (service_choosen == 2)
{
cout<<"you choose the service of Training : 90 Days
challenge"<<"\n";
string str;
cout << "Please Enter Membership Type : \n";
getline (cin, str);
cout << "Hello,you choose " << str << "\n";
if (str == individual)
{
total_price_individual =
5000 + (5000*0.01);
cout <<"your total
cost for all services are : ";
cout <<
total_price_individual;
}
else if (str ==
couple)
{
total_price_couple =
8000 + (8000*0.1);
cout <<"your total
cost for all services are : ";
cout <<
total_price_couple;
}
else if (str ==
people_4)
{
total_price_people_4 =
12000 + (12000*0.15);
cout <<"your total
cost for all services are : ";
cout <<
total_price_people_4;
}
else
cout<<"you put wrong choice";
}
if (service_choosen == 3)
{
cout<<"you choose the service of Aquatics: Kids free training
session"<<"\n";
string str;
cout << "Please Enter Membership Type : \n";
getline (cin, str);
cout << "Hello,you choose " << str << "\n";
if (str == individual)
{
total_price_individual =
5000 + (5000*0.01);
cout <<"your total
cost for all services are : ";
cout <<
total_price_individual;
}
else if (str ==
couple)
{
total_price_couple =
8000 + (8000*0.1);
cout <<"your total
cost for all services are : ";
cout <<
total_price_couple;
}
else if (str ==
people_4)
{
total_price_people_4 =
12000 + (12000*0.15);
cout <<"your total
cost for all services are : ";
cout <<
total_price_people_4;
}
else
cout<<"you put wrong choice";
}
return 0;
}
This program will run only one time .
and if you want to execute it many times , just put in while loop and condition is of your choice.