Gym Membership Calculator Project - C# Programming at University

Verified

Added on  2020/05/28

|6
|638
|45
Project
AI Summary
This document presents a C# project implementing a Gym Membership Calculator. The project calculates membership fees based on the number of weeks, incorporating discounts and handling various scenarios. The program utilizes object-oriented programming principles, creating objects for each member and storing their data. Input validation ensures data accuracy, while error handling manages incorrect entries. The calculator's functionality includes calculating costs, applying discounts, and displaying the results in a tabular format. The program also determines the maximum and minimum spenders. The document includes test cases to validate the program's functionality across various scenarios, including different week values, discount statuses, and edge cases. The program is tested for the correct execution and the screenshots are provided to demonstrate the proper execution of the test cases. The bibliography includes resources used in the development of the project.
Document Page
Running head: GYM MEMBERSHIP CALCULATOR
Gym Membership Calculator
Name of the Student:
ID of the Student:
Name of the University:
Author note:
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
1
GYM MEMBERSHIP CALCULATOR
Code Explanation
The Gym Membership Calculator is designed with the motive to calculate the
membership charges of a particular number of members. Each member enters their number of
weeks and the discounts if they have any. The calculation is then done based on the requirement
guideline. Later a statistical data is also presented.
For each member, an object is created and put into an object array. Each object has the
member’s name, weeks and discount status. As the user enters values for each member, their
charges is calculated through the calculate() function. However, the program also checks for
input validity. This prevents the user from entering wrong values. An error message is printed
and the user is asked to re-enter the asked field’s value. The recursion is achieved using a
while(true) loop block, which breaks if a valid input is entered. The validity of discount status
entry is also checked. To add more reality, a check is also kept to assure that the user must enter
a name for the members. The price tag is checked using multiple Conditional statements and the
discount is subtracted if necessary. The data of each object is then printed in a tabular format. On
completion of each input and charges output process, the program checks for the maximum and
minimum spender in the Gym. This is achieved with two max and min variables that update
themselves as the user enters values for each member. Later these values are printed accordingly.
Document Page
2
GYM MEMBERSHIP CALCULATOR
Testing and Output
Test case 1 (Member 1): to check if the program is performing normally with normal entry of
value. 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 other
than “yes” or “no”.
Test case 10: It is also noticed that the table displays the membership data accurately for each
member.
Test case 11: The statistically collected data of who has spent the most and the least of amount is
displayed properly along with the number of members who have applied for more than and less
than 8 weeks.
Document Page
3
GYM MEMBERSHIP CALCULATOR
The screenshots that depict the correct execution of the above test cases are provided
below.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
4
GYM MEMBERSHIP CALCULATOR
Document Page
5
GYM MEMBERSHIP CALCULATOR
Bibliography
[1] Doyle, Barbara. C# Programming: From Problem Analysis to Program Design. Cengage
Learning, 2013.
[2] Sharp, John. Microsoft Visual C# 2012 Step by Step. Pearson Education, 2012.
chevron_up_icon
1 out of 6
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]