The Gym Membership Calculator (Doc)

Added on - 28 May 2020

  • 6


  • 638


  • 4


  • 0


Showing pages 1 to 3 of 6 pages
Running head: GYM MEMBERSHIP CALCULATORGym Membership CalculatorName of the Student:ID of the Student:Name of the University:Author note:
1GYM MEMBERSHIP CALCULATORCode ExplanationThe Gym Membership Calculator is designed with the motive to calculate themembership charges of a particular number of members. Each member enters their number ofweeks and the discounts if they have any. The calculation is then done based on the requirementguideline. Later a statistical data is also presented.For each member, an object is created and put into an object array. Each object has themember’s name, weeks and discount status. As the user enters values for each member, theircharges is calculated through the calculate() function. However, the program also checks forinput validity. This prevents the user from entering wrong values. An error message is printedand the user is asked to re-enter the asked field’s value. The recursion is achieved using awhile(true) loop block, which breaks if a valid input is entered. The validity of discount statusentry is also checked. To add more reality, a check is also kept to assure that the user must entera name for the members. The price tag is checked using multiple Conditional statements and thediscount is subtracted if necessary. The data of each object is then printed in a tabular format. Oncompletion of each input and charges output process, the program checks for the maximum andminimum spender in the Gym. This is achieved with two max and min variables that updatethemselves as the user enters values for each member. Later these values are printed accordingly.
2GYM MEMBERSHIP CALCULATORTesting and OutputTest case 1(Member 1): to check if the program is performing normally with normal entry ofvalue. The discount factor is also checked.Test case 2(Member 2): Checks if the program can handle week’s value that is below 1.Test case 3(Member 3): Checks if the program can handle week’s value that is above 30.Test case 4(Member 4-5): Checks the case sensitivity of the discount status entry.Test case 5(Member 6): Checks if the price tag works properly for the 9 to 16 range.Test case 6(Member 7): Checks if the price tag works well for the >16 range.Test case 8(Member 8): Checks if the program can handle the situation if no name is entered.Also does this ensure that the price tag works properly for weeks below 8.Test case 9(Member 9): Checks if the discount status entry can handle errors due to entry otherthan “yes” or “no”.Test case 10: It is also noticed that the table displays the membership data accurately for eachmember.Test case 11: The statistically collected data of who has spent the most and the least of amount isdisplayed properly along with the number of members who have applied for more than and lessthan 8 weeks.
You’re reading a preview

To View Complete Document

Become a Desklib Library Member.
Subscribe to our plans

Unlock This Document