Saturday, May 22, 2010

This is for an intro to programming, how can I write this C++ program?

A health club has three memberships: regular, premium, and gold. The membership fees (per month) are $400, $600, and $800 respectively. Club members have access to gym facilities at any time during opening hours and personalized trainer services are available for an additional charge of $10 per session for premium members and $5 per session for gold members. Tennis courts can be reserved and utilized by all members at a cost of $15 per hour for regulars, $10 for premium members, and free for Gold members, for up to 20 hours of usage per month. An additional charge of $5 will be incurred if the 20 hour limit is exceeded. At the end of the month, members are charged for services provided during the month, as well as membership fees for the next month. Write a C++ program that displays each customer's bill. Include the name of the member, the type of membership, number of times he/she took advantage of special services, the membership fee for the next month, and total amount owed.

This is for an intro to programming, how can I write this C++ program?
use class its better so tat for gold member u have different kind of asseability.... u can use pulic,private n protected.....


ok now create 3 class namely regular,premium %26amp; gold....


define wat all u need in each class like the memebership fee for regular, premium %26amp; gold let them b constant .. so there wil one constant variable in each class.... and all the extra charges to b defined in each class .... use this concept it wil b more realiable


and eacy to print the bill of different members AND VERY IMPOTANT KEEP SEPARATE ACCOUNT FOR EACH MEMBER SO THAT U CAN HAVE THE TRACK OF EACH MEMBERS ACCOUNT AND CAN EASILY PRODUCE BILL%26gt;%26gt;%26gt;.... u can take input like wat kind of membership they neeg like regular,primium...... according to that save the members in particular class.... hope tat helped...:-)
Reply:Use structs. That way you can lump together stuff for the regular, premium, and gold members and give them different values. Inside those structs, also create counter variables that will keep track of how many times services were used. Then just multiply the times the services were used by the cost of the service. From there, just have it print out all the costs in the struct added together.

palm

No comments:

Post a Comment