Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The cost to become a member of a fitness center is as follows: (a) the Senior ci

ID: 3661891 • Letter: T

Question

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 in advance, the discount is 15%; or (c) if more than 5 personal training sessions are purchased, the discount on each session is 20%. Write a menu driven program that determines the cost of a new membership. Yourprogrammustcontainamethodthatdisplaysthegeneralinformationabout the fitness center and its charges, a method to get all the necessary information to determine the membership cost, and a method to determine the membership cost. Use appropriate parameters to pass information in and out of a method.

Explanation / Answer

#include <bits/stdc++.h>
using namespace std;

// ASSUMING BASIC PRICE IS 10000; for each session we have 100 rupees price
int com_price(int age,bool membership,int month,int session){
    int price = 10000;
    if (age >= 60)
        price -= 3000;
    if (membership == true && month >= 12){
        price -= 1500;
        price = month*price;
    }
    if (session > 5)
        price += 80*session;
    else
        price += 100*session;
    return price;
}

int main(){
    string name;
    int age,month,session;
    char ch;
    cout << "Enter the name :   ";
    cin >> name;
    cout << "Enter age : ";
    cin >> age;
    cout << "Enter y or n if you want to get a membership (you have to pay for 12 month in advance) : ";
    cin >> ch;
    cout << "Enter month for which you want to have membership (>=12) : ";
    cun >> month;
    cout << "Enter session purchased : ";
    cin >> session;
    int price;
    if (ch == 'y')
        price = com_price(age,true,month,session);
    else
        price = com_price(age,false,month,session);
    cout << "price is : " << price << endl;
    return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote