C# Application: Gym Membership Calculator

pages Pages: 4word Words: 890

Question :

Assignment 1 – Practical Programming Project


This assessment is designed to assess your understanding of variables, constants, types, operators, input/output, loops, if statements, classes, objects and functions.


Create a C# application that calculate and displays membership fees for N customers who registered for membership from a sport center based in Victoria, Australia. Declared a constant variable M to be equal to the largest digit of your student id number (e.g. if your student id is s3025423 then M should be equal to 5). Assume M=4, if the largest digit of your student id number is less than 4. The standard charges of membership are shown below

Length of Membership
Rate (including tax)
1-6 months
$30.0 per month
6-12 months
$27.5 per month
More than 12 months
$25.0 per month

Specific Requirements

  • The application should ask the user to enter the customer name, the number of months for membership, and yes or no to indicate whether the customer receives a special offer or not. The special offer will give customers a 15% discount of the memship no matter how many months they register.
  • Assume that the number of month to be entered is an integer type with the range between 1 and 60. An error message should be issued if a user enters a value beyond this range and the re-entering is required.
  • The program makes a calculation of membership and displays the result as shown in the below figure. The program should be kept running with entering next set of input data

sport membership calculator

  • After all M sets of input data are entered from the keyboard, your program will also display the information that includes the customer spending most, the customer spending least as well as a simple bar chart to display how many members with the number of months are less than 6 months and greater than/equal 6 months as shown in the below figure

summary of membership fee

  • The application should be user-friendly by displaying appropriate welcome, exit and error message. Your program should be run as normal without changing any source code except setting M with a different value.


Show More

Answer :

Gym Membership Calculator

How the Program works

1. We have a single cs file which has two classes MemberMain and Customer.

2. Customer class has three attributes consumerName, membershipMonths and discountedConsumer

* consumerName : name of Customer

* membershipMonths : months of membership for this consumer

* discountedConsumer : whether discount will be given to this customer or not

3. MemberMain class makes an object of MemberMain and call various methods.
We compile the program by mcs Member.cs 
And run it by mono Member.exe


Gym membership calculator

gym membership fee calculator

summary of gym membership fee calculator

Test Plan

Result Test Plan

#Consumer Name# of WeeksDiscount Given ?Expected OutputActual OutputResult
6Test 640YES850850Pass

Validation Test Plan

#CaseExpected OutputActual OutputResult
7# of Weeks : -3Error message and ask user to reenterError message and ask user to reenterPass
8# of Weeks : 75Error message and ask user to reenterError message and ask user to reenterPass