Question

In: Computer Science

C Code The cost to become a member of a fitness center is as follows: (a)...

C Code

The cost to become a member of a fitness center is as follows:

(a) the senior citizens discount is 30%

(b) if the membership is bought and paid for 12 or more months, the discount is 15%

(c) if more than five personal training sessions are bought and paid for, the discount on each session is 20% Write a that determines the cost of a new membership.

Your program must contain: a function that displays the general information about the fitness center and its charges a function that prompts for the price per month of a membership and the cost of each personal trainer session (use pass by pointer parameters) a function that prompts for all of the necessary information to determine the cost of a membership (use pass by pointer parameters) a function to determine the membership cost (use pass by value parameters)

For Example: This program determines the cost of a new membership.

If you are a senior citizen, then the discount is 30% of the regular membership price.

If you buy membership for twelve months and pay today, the discount is 15%

If you buy and pay for 6 or more personal training session today, the discount on each session is 20%

Enter the cost of a regular membership per month: 100

Enter the cost of one personal training session: 11

Are you a senior citizen (Y|y/N|n): n

Enter the number of personal training sessions bought: 3

Enter the number of month you are paying for: 13

The membership cost = $1138.00

Solutions

Expert Solution

Source Code :

#include<stdio.h>
int cpm,cpt,nt,nm;
char sc;
void general_info_fitness_center()
{
printf("\nThis program determines the cost of a new membership.\nIf you are a senior citizen, then the discount is 30% (of the regular membership price).\nIf you buy membership for twelve months and pay today, the discount is 15%.\nIf you buy and pay for 6 or more personal training session today, the discount on each session is 20%\n"); //showing info about fitness center and prices
}
void prompt_price()
{
printf("\nEnter the cost of a regular membership per month: ");
scanf("%d",&cpm);// cost per month
printf("Enter the cost of one personal training session:" );
scanf("%d",&cpt); //cost per training session
}

void prompt_necessary_info()
{
printf("\nAre you a senior citizen (Y|y/N|n):");
scanf(" %c",&sc); //senior citizenship
printf("Enter the number of personal training sessions bought:");
scanf("%d",&nt); //number of training sessions
printf("Enter the number of month you are paying for:");
scanf("%d",&nm); //number of months
}

void membership_cost(char sc,int nt,int nm,int cpm,int cpt)
{
float month_discount,training_discount,total_price;
float total_month=nm*cpm; //total charge for total month without any discount
float total_training=nt*cpt; //total charge for total training sessions without any discount
if(nt>=6) //if number of training sessions are morethan 5
{
training_discount=(total_training*20)/100; //then discount is 20%
total_training=total_training-training_discount; //then substract discount from total charge for training sessions
}
if(sc=='Y' || sc=='y') //if he is senior citizen
{
month_discount= (total_month*30)/100; //then discount is 30%
total_month=total_month-month_discount; //then substract discount from total charge for months
}
else //if he is not senior citizen
{
if(nm>=12) //and number of month paying is greater than or equal to 12
{
month_discount= (total_month*15 )/100; //then discount is 15%
total_month=total_month-month_discount; //then substract discount from total charge for months
}
}
total_price=total_month+total_training; //then total charges for membership is sum of total charge for total month and total charge for total training sessions
printf("\nThe membership cost :%f\n",total_price); //printing membership cost
}

int main()
{
general_info_fitness_center();
prompt_price();
prompt_necessary_info();
membership_cost(sc,nt,nm,cpm,cpt);
return 0;
}

Code Screenshots :

OUTPUT :


Related Solutions

(IN C LANGUAGE) The cost to become a member of a fitness center is as follows:...
(IN C LANGUAGE) The cost to become a member of a fitness center is as follows: (a) the senior citizens discount is 30% (b) if the membership is bought and paid for 12 or more months, the discount is 15% (c) if more than five personal training sessions are bought and paid for, the discount on each session is 20% Write a that determines the cost of a new membership. Your program must contain: a function that displays the general...
You are hired to design a database for a fitness center. As the fitness center is...
You are hired to design a database for a fitness center. As the fitness center is expanding with more than one branch, they want to create a database to keep track of its customers, facilities and employees. Each branch has a unique id and address (building number, street, district, and city). A branch may have more than one facility (e.g. swimming pool, spa, etc.). Each facility must belong to only one branch, and the information for a facility is name...
You are hired to design a database for a fitness center. As the fitness center is...
You are hired to design a database for a fitness center. As the fitness center is expanding with more than one branch, they want to create a database to keep track of its customers, facilities and employees. Each branch has a unique id and address (building number, street, district, and city). A branch may have more than one facility (e.g. swimming pool, spa, etc.). Each facility must belong to only one branch, and the information for a facility is name...
Write a C# code that creates objects and classes with their member functions for KrisFlyer, a...
Write a C# code that creates objects and classes with their member functions for KrisFlyer, a Singapore Airlines Loyalty program. You are asked to write an inheritance hierarchy discount system that benefits KrisFlyer members program to calculate their profit. A brief about KrisFlyer is that it is useful for those who fly on Singapore Airlines (its partners like Virgin Australia and Air New Zealand) frequently. KrisFlyer miles can be earned through credit cards, flying and bonus miles promotions. The miles...
Mixed Costs and Cost Formula Callie's Gym is a complete fitness center. Owner Callie Ducain employs...
Mixed Costs and Cost Formula Callie's Gym is a complete fitness center. Owner Callie Ducain employs various fitness trainers who are expected to staff the front desk and to teach fitness classes. While on the front desk, trainers answer the phone, handle walk-ins and show them around the gym, answer member questions about the weight machines, and do light cleaning (wiping down the equipment, vacuuming the floor). The trainers also teach fitness classes (e.g., pilates, spinning, body pump) according to...
Mixed Costs and Cost Formula Callie's Gym is a complete fitness center. Owner Callie Ducain employs...
Mixed Costs and Cost Formula Callie's Gym is a complete fitness center. Owner Callie Ducain employs various fitness trainers who are expected to staff the front desk and to teach fitness classes. While on the front desk, trainers answer the phone, handle walk-ins and show them around the gym, answer member questions about the weight machines, and do light cleaning (wiping down the equipment, vacuuming the floor). The trainers also teach fitness classes (e.g., pilates, spinning, body pump) according to...
the owner of a fitness center is interested in estimating the difference in mean years that...
the owner of a fitness center is interested in estimating the difference in mean years that female members have been with the club compared with male members. he wishes to develop a 99% confidence interval estimate. The data are showen in the accompanying table. Assuming that the same data are approximately normal and that the two populations have equal variances, develop and interpret the confidence interval estimate. dicuss the results gender 1=male 2=female 1 2 2 2 1 2 2...
The owner of a fitness center is interested in estimating the difference in mean years that...
The owner of a fitness center is interested in estimating the difference in mean years that female members have been with the club compared with male members. He wishes to develop a 95​% confidence interval estimate. The data are shown in the accompanying table. Assuming that the sample data are approximately normal and that the two populations have equal​ variances, develop and interpret the confidence interval estimate. Discuss the result. Gender_(1=Male_2=Female) Years_With_the_Club 2 3.5 2 1 1 3 2 2...
A fitness center is interested in finding a 98% confidence interval for the mean number of...
A fitness center is interested in finding a 98% confidence interval for the mean number of days per week that Americans who are members of a fitness club go to their fitness center. Records of 213 members were looked at and their mean number of visits per week was 3.5 and the standard deviation was 1.8. Round answers to 3 decimal places where possible. a. To compute the confidence interval use a distribution. b. With 98% confidence the population mean...
A fitness center is interested in finding a 98% confidence interval for the mean number of...
A fitness center is interested in finding a 98% confidence interval for the mean number of days per week that Americans who are members of a fitness club go to their fitness center. Records of 251 members were looked at and their mean number of visits per week was 3.1 and the standard deviation was 2.8. Round answers to 3 decimal places where possible. a. To compute the confidence interval use a Z or T distribution? b. With 98% confidence...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT