Create content

# Need Program Output for a health card menu

No of visitors who read this post: 675
Category: C++
Type: Question
Author: JAlbert

Hi

I need to write a program. It’s very much difficult for me to attempt without any help. Please give me an idea solution to understand how can i solve this program?

This is about to write a program that will display the following menu of a health club:

2. Child Membership
3. Senior Citizen Membership
4. Quit the program

The program will take input from the user about the choice selection of above menu and also will take number of months. Then the program will calculate the membership charges for the given number of months as follows:

2. Child Membership                                Rs.20
3. Senior Citizen Membership                   Rs.30

## Comment viewing options

### # Comment Id: 5222

Hi

I am giving you the idea solution for this problem. You need to read your books as well as your instructor’s help to fully solve this.

Firstly you need to show the output on the screen “Health Club Membership Menu”.

2. Child Membership
3. Senior Citizen Membership
4. Quit the program

Then you will take the user input for the choice of menu item. Then you will take the input for the number of months. And lastly you will calculate the charges of club membership according to your choice for the given number of months.

That’s it. Hope you will be ok with this. Let me know for more other help.

### # Comment Id: 5231

Thanks a lot Sahil; I am waiting for the idea solution from long time.

Please help me to understand, how the user will select menu item from the menu. Because I found it’s very difficult to match a string in programming. Whether I need to match the string of menu item or I can use any other option that suits best.

Waiting

### # Comment Id: 5244

Can any one send the code please???????????

### # Comment Id: 5253

The user will select the menu in the form of integers. 1 will represents first option, 2 will second option and so on.  And then you can use if else or Switch statement to calculate the charges for the given months by the user.

### # Comment Id: 5260

Thanks a lot Sahil

I am trying your given concepts in compiler. As I got the result, I will send you my code for checking.

Regards

### # Comment Id: 5270

#include<iostream.h>

#include<iomanip.h>

void main()

{

int choice, months;

Double charges

cout<<”2. Child Membership “<<endl;

cout<<”3.  Senior Citizen Membership “<<endl;

cout<<”4. Quit the program  “<<endl;

Cin>>choice;

If(choice>=1 && choice<=3)

{

cout<<” For how many months “<<endl;

cin>>months;

switch(choice)

{

case1: charges=months*50.0;

break

case2: charges=months*20.0;

break

case3: charges=months*30.0;

break

}

cout<<” The total chares are” <<charges<<endl;

}

else if(choice!=4)

{

cout<<” The valid choices are 1 to 4” <<endl;

cout<<” Run the program again and selects these choices” <<endl;

}

}

### # Comment Id: 5271

Marvelous solution

You are the best Mark Jason

Heartily Thankful to you dear

Stay Blessed and Happy.