C++ Program: Health Club Membership, Documentation, and Testing
VerifiedAdded on 2023/06/10
|26
|5023
|395
Practical Assignment
AI Summary
This assignment provides comprehensive documentation and testing for a C++ health club membership program. It includes user documentation with GUI and command-line interface descriptions, enhanced program comments, and a guide to running the program. The technical documentation details the program's purpose, source code, include files, data files, and function descriptions for `showMenu()` and `showFees()`. Furthermore, the assignment addresses error handling by demonstrating discrimination between syntax and semantic errors with examples from the source code. It also designs and justifies a testing strategy covering normal, extreme, and exceptional test cases for each functionality, along with methods for detecting logic errors, accompanied by sample screenshots. This document is a valuable resource for understanding C++ programming, software documentation, and testing methodologies, available for study on Desklib.

ASSIGNMENT
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Contents
Task 1....................................................................................................................................................2
a) Produce user documentation for the above completed programming application including the
user interface design and additional/enhanced program comments wherever necessary...............2
b) Develop technical documentation for the above program application for ease of maintenance. 6
Task 2..................................................................................................................................................12
a) Amend the above program to demonstrate discrimination between semantic and syntax errors.
.........................................................................................................................................................12
b) Design and justify a testing strategy for normal, extreme and exceptional tests for each item of
functionality.....................................................................................................................................15
c) Amend the above program and construct test data and schedules to detect at least three logic
errors...............................................................................................................................................16
d) Use appropriate techniques for detecting errors in (b) and (c) with sample screenshots. Where
appropriate, detail any major action that you have taken in light of the testing............................19
Task 1....................................................................................................................................................2
a) Produce user documentation for the above completed programming application including the
user interface design and additional/enhanced program comments wherever necessary...............2
b) Develop technical documentation for the above program application for ease of maintenance. 6
Task 2..................................................................................................................................................12
a) Amend the above program to demonstrate discrimination between semantic and syntax errors.
.........................................................................................................................................................12
b) Design and justify a testing strategy for normal, extreme and exceptional tests for each item of
functionality.....................................................................................................................................15
c) Amend the above program and construct test data and schedules to detect at least three logic
errors...............................................................................................................................................16
d) Use appropriate techniques for detecting errors in (b) and (c) with sample screenshots. Where
appropriate, detail any major action that you have taken in light of the testing............................19

Task 1
a) Produce user documentation for the above completed
programming application including the user interface design
and additional/enhanced program comments wherever
necessary.
Solution:
User Documentation:
Graphical User interface:
Command Line interface:
a) Produce user documentation for the above completed
programming application including the user interface design
and additional/enhanced program comments wherever
necessary.
Solution:
User Documentation:
Graphical User interface:
Command Line interface:
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Program with Comments:
// FILE: healthclub.cpp
// TITLE: Health Club Membership
// SUBMITTED BY:
// FOR COURSE:
// DATE:
// PURPOSE:
// This is a menu-driven program that helps users
// to calculate membership fees based on the membership type
// and duration of the membership
// header files need for the application
#include <iostream>
#include <iomanip>
using namespace std;
// Function prototypes
// Function to be used are declared here
void showMenu();
void showFees(double, int);
// main method of the program
// all other method are called from this method
int main()
{
int choice; // To hold a menu choice
int months; // To hold a number of months
// Constants for the menu choices
const int ADULT_CHOICE = 1,
CHILD_CHOICE = 2,
SENIOR_CHOICE = 3,
QUIT_CHOICE = 4;
// Constants for membership rates
const double ADULT = 40.0,
CHILD = 20.0,
SENIOR = 30.0;
// Set up numeric output formatting.
cout << fixed << showpoint << setprecision(2);
// to keep running the program until (4) Quit option
// is selected
do
{
// Display the menu and get the user's choice.
showMenu();
cin >> choice;
// FILE: healthclub.cpp
// TITLE: Health Club Membership
// SUBMITTED BY:
// FOR COURSE:
// DATE:
// PURPOSE:
// This is a menu-driven program that helps users
// to calculate membership fees based on the membership type
// and duration of the membership
// header files need for the application
#include <iostream>
#include <iomanip>
using namespace std;
// Function prototypes
// Function to be used are declared here
void showMenu();
void showFees(double, int);
// main method of the program
// all other method are called from this method
int main()
{
int choice; // To hold a menu choice
int months; // To hold a number of months
// Constants for the menu choices
const int ADULT_CHOICE = 1,
CHILD_CHOICE = 2,
SENIOR_CHOICE = 3,
QUIT_CHOICE = 4;
// Constants for membership rates
const double ADULT = 40.0,
CHILD = 20.0,
SENIOR = 30.0;
// Set up numeric output formatting.
cout << fixed << showpoint << setprecision(2);
// to keep running the program until (4) Quit option
// is selected
do
{
// Display the menu and get the user's choice.
showMenu();
cin >> choice;
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

// Validate the menu selection.
while (choice < ADULT_CHOICE && choice > QUIT_CHOICE)
{
cout << "Please enter a valid menu choice: ";
cin >> choice;
}
// If the user does not want to quit, proceed.
if (choice != QUIT_CHOICE)
{
// Get the number of months.
cout << "For how many months? ";
cin >> months;
// Display the membership fees based on the user input.
switch (choice)
{
case ADULT_CHOICE:
showFees(ADULT, months);
break;
case CHILD_CHOICE:
showFees(CHILD, months);
break;
case SENIOR_CHOICE:
showFees(SENIOR, months);
break;
}
}//correction
} while (choice!= QUIT_CHOICE);//correction
return 0;
}
//*************************************************************
// Definition of function showMenu which displays the menu.
// Displays the list of Memberships offered at the Club
// Provides user with menu option to select from.
//*************************************************************
void showMenu()
{
cout << "\n\t\tHealth Club Membership Menu\n\n"
<< "1. Standard Adult Membership\n"
<< "2. Child Membership\n"
<< "3. Senior Citizen Membership\n"
<<"4. Quit the Program\n\n"
<< "Enter your choice: ";
}
while (choice < ADULT_CHOICE && choice > QUIT_CHOICE)
{
cout << "Please enter a valid menu choice: ";
cin >> choice;
}
// If the user does not want to quit, proceed.
if (choice != QUIT_CHOICE)
{
// Get the number of months.
cout << "For how many months? ";
cin >> months;
// Display the membership fees based on the user input.
switch (choice)
{
case ADULT_CHOICE:
showFees(ADULT, months);
break;
case CHILD_CHOICE:
showFees(CHILD, months);
break;
case SENIOR_CHOICE:
showFees(SENIOR, months);
break;
}
}//correction
} while (choice!= QUIT_CHOICE);//correction
return 0;
}
//*************************************************************
// Definition of function showMenu which displays the menu.
// Displays the list of Memberships offered at the Club
// Provides user with menu option to select from.
//*************************************************************
void showMenu()
{
cout << "\n\t\tHealth Club Membership Menu\n\n"
<< "1. Standard Adult Membership\n"
<< "2. Child Membership\n"
<< "3. Senior Citizen Membership\n"
<<"4. Quit the Program\n\n"
<< "Enter your choice: ";
}

//*************************************************************
// Definition of function showFees. The memberRate parameter *
// holds the monthly membership rate and the months parameter *
// holds the number of months. The function displays the total*
// charges.
// Calculates total charges by multiplying membership rate with
// total month for which the member ship is taken and
// display the total charges calculated to the console.
//*************************************************************
void showFees(double memberRate,int months) //correction
{
cout << "The total charges are $"
<< (memberRate * months) << endl;
}
Guide to run the program:
1. Compile and run the program
2. Select the membership by pressing 1 for Standard Adult Membership, 2 for child
membership, 3 for Senior Citizen member ship.
3. After enter the valid membership.
4. Enter duration in months.
5. The program will display the Total charges for the enter membership and duration.
6. Select option 4 from the menu to quit or stop the program.
// Definition of function showFees. The memberRate parameter *
// holds the monthly membership rate and the months parameter *
// holds the number of months. The function displays the total*
// charges.
// Calculates total charges by multiplying membership rate with
// total month for which the member ship is taken and
// display the total charges calculated to the console.
//*************************************************************
void showFees(double memberRate,int months) //correction
{
cout << "The total charges are $"
<< (memberRate * months) << endl;
}
Guide to run the program:
1. Compile and run the program
2. Select the membership by pressing 1 for Standard Adult Membership, 2 for child
membership, 3 for Senior Citizen member ship.
3. After enter the valid membership.
4. Enter duration in months.
5. The program will display the Total charges for the enter membership and duration.
6. Select option 4 from the menu to quit or stop the program.
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

b) Develop technical documentation for the above program
application for ease of maintenance.
Solution:
Technical Documentation:
Name: Health Club Membership Calculator
Version: 1.0
Programming Language: C++
Purpose: To calculate total cost enquired by members based on the membership type and
duration of the membership.
Source Code:
// This is a menu-driven program that makes a function call
// for each selection the user makes
#include <iostream>
#include <iomanip>
using namespace std;
// Function prototypes
void showMenu();
void showFees(double, int);
int main()
{
int choice; // To hold a menu choice
int months; // To hold a number of months
// Constants for the menu choices
const int ADULT_CHOICE = 1,
CHILD_CHOICE = 2,
SENIOR_CHOICE = 3,
QUIT_CHOICE = 4;
// Constants for membership rates
const double ADULT = 40.0,
CHILD = 20.0,//correction
SENIOR = 30.0;
// Set up numeric output formatting.
cout << fixed << showpoint << setprecision(2);
do
{
// Display the menu and get the user's choice.
showMenu();
application for ease of maintenance.
Solution:
Technical Documentation:
Name: Health Club Membership Calculator
Version: 1.0
Programming Language: C++
Purpose: To calculate total cost enquired by members based on the membership type and
duration of the membership.
Source Code:
// This is a menu-driven program that makes a function call
// for each selection the user makes
#include <iostream>
#include <iomanip>
using namespace std;
// Function prototypes
void showMenu();
void showFees(double, int);
int main()
{
int choice; // To hold a menu choice
int months; // To hold a number of months
// Constants for the menu choices
const int ADULT_CHOICE = 1,
CHILD_CHOICE = 2,
SENIOR_CHOICE = 3,
QUIT_CHOICE = 4;
// Constants for membership rates
const double ADULT = 40.0,
CHILD = 20.0,//correction
SENIOR = 30.0;
// Set up numeric output formatting.
cout << fixed << showpoint << setprecision(2);
do
{
// Display the menu and get the user's choice.
showMenu();
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

cin >> choice;
// Validate the menu selection.
while (choice < ADULT_CHOICE && choice > QUIT_CHOICE)
{
cout << "Please enter a valid menu choice: ";
cin >> choice;
}
// If the user does not want to quit, proceed.
if (choice != QUIT_CHOICE)
{
// Get the number of months.
cout << "For how many months? ";
cin >> months;
// Display the membership fees.
switch (choice)
{
case ADULT_CHOICE:
showFees(ADULT, months);
break;
case CHILD_CHOICE:
showFees(CHILD, months);
break;
case SENIOR_CHOICE:
showFees(SENIOR, months);
break;
}
}//correction
} while (choice!= QUIT_CHOICE);//correction
return 0;
}
//*************************************************************
// Definition of function showMenu which displays the menu.
//*************************************************************
void showMenu()
{
cout << "\n\t\tHealth Club Membership Menu\n\n"
<< "1. Standard Adult Membership\n"
<< "2. Child Membership\n"
<< "3. Senior Citizen Membership\n"
<<"4. Quit the Program\n\n"
<< "Enter your choice: ";
}
// Validate the menu selection.
while (choice < ADULT_CHOICE && choice > QUIT_CHOICE)
{
cout << "Please enter a valid menu choice: ";
cin >> choice;
}
// If the user does not want to quit, proceed.
if (choice != QUIT_CHOICE)
{
// Get the number of months.
cout << "For how many months? ";
cin >> months;
// Display the membership fees.
switch (choice)
{
case ADULT_CHOICE:
showFees(ADULT, months);
break;
case CHILD_CHOICE:
showFees(CHILD, months);
break;
case SENIOR_CHOICE:
showFees(SENIOR, months);
break;
}
}//correction
} while (choice!= QUIT_CHOICE);//correction
return 0;
}
//*************************************************************
// Definition of function showMenu which displays the menu.
//*************************************************************
void showMenu()
{
cout << "\n\t\tHealth Club Membership Menu\n\n"
<< "1. Standard Adult Membership\n"
<< "2. Child Membership\n"
<< "3. Senior Citizen Membership\n"
<<"4. Quit the Program\n\n"
<< "Enter your choice: ";
}

//*************************************************************
// Definition of function showFees. The memberRate parameter *
// holds the monthly membership rate and the months parameter *
// holds the number of months. The function displays the total*
// charges.
//*************************************************************
void showFees(double memberRate,int months) //correction
{
cout << "The total charges are $"
<< (memberRate * months) << endl;
}
Include Files:
iostream
iomanip
Data Files: None.
Functions:
1) void showMenu()
Purpose: To display the menu options
Parameters: Accept no parameters
Return: Void
Functionality: To print the menu options
Calls TO: None
Called FROM: main method
Implementation:
void showMenu()
{
cout << "\n\t\tHealth Club Membership Menu\n\n"
<< "1. Standard Adult Membership\n"
<< "2. Child Membership\n"
<< "3. Senior Citizen Membership\n"
<<"4. Quit the Program\n\n"
<< "Enter your choice: ";
}
2) void showFees(double, int)
// Definition of function showFees. The memberRate parameter *
// holds the monthly membership rate and the months parameter *
// holds the number of months. The function displays the total*
// charges.
//*************************************************************
void showFees(double memberRate,int months) //correction
{
cout << "The total charges are $"
<< (memberRate * months) << endl;
}
Include Files:
iostream
iomanip
Data Files: None.
Functions:
1) void showMenu()
Purpose: To display the menu options
Parameters: Accept no parameters
Return: Void
Functionality: To print the menu options
Calls TO: None
Called FROM: main method
Implementation:
void showMenu()
{
cout << "\n\t\tHealth Club Membership Menu\n\n"
<< "1. Standard Adult Membership\n"
<< "2. Child Membership\n"
<< "3. Senior Citizen Membership\n"
<<"4. Quit the Program\n\n"
<< "Enter your choice: ";
}
2) void showFees(double, int)
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Purpose: To display the calculated total price
Parameters: Accept two parameters first one is of type double (membership rate) and
second one is of type integer (months)
Name Type Reference/value Description
memberRate Double Value Rate of select
membership. For
example
ADULT=40.0
months int Value Number of month
Return: Void
Functionality: To calculate the total charge by multiplying membership rate with no of
months and display the result (memberRate * months).
Calls TO: None
Called FROM: main method
Implementation:
void showFees(double memberRate,int months) //correction
{
cout << "The total charges are $"
<< (memberRate * months) << endl;
}
3)main method
Variables:
Name Type Description
choice int To store user input for
menu choice
months Int To store number of month
entered
Constants:
Name Type Value Description
ADULT_CHOICE int 1 Menu option 1
CHILD_CHOICE int 2 Menu option 2
SENIOR_CHOICE int 3 Menu option 3
QUIT_CHOICE int 4 Menu option 4
Parameters: Accept two parameters first one is of type double (membership rate) and
second one is of type integer (months)
Name Type Reference/value Description
memberRate Double Value Rate of select
membership. For
example
ADULT=40.0
months int Value Number of month
Return: Void
Functionality: To calculate the total charge by multiplying membership rate with no of
months and display the result (memberRate * months).
Calls TO: None
Called FROM: main method
Implementation:
void showFees(double memberRate,int months) //correction
{
cout << "The total charges are $"
<< (memberRate * months) << endl;
}
3)main method
Variables:
Name Type Description
choice int To store user input for
menu choice
months Int To store number of month
entered
Constants:
Name Type Value Description
ADULT_CHOICE int 1 Menu option 1
CHILD_CHOICE int 2 Menu option 2
SENIOR_CHOICE int 3 Menu option 3
QUIT_CHOICE int 4 Menu option 4
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

ADULT double 40.0 Adult membership
cost per month
CHILD double 20.0 Child membership
cost per month
SENIOR double 30.0 Senior membership
cost per month
Functionality:
Repeatedly display the menu with 4 option calling showMenu() functions.
Accept user’s choice.
If user enter number 1,2 or 3 then.
Ask for number of months.
Accept the input.
Call the showFees(double,int) method with selected membership rate and months.
Exit the program on selecting quit from menu (option 4).
Calls TO: showMenu() and showFees(double,int)
Sample Run:
cost per month
CHILD double 20.0 Child membership
cost per month
SENIOR double 30.0 Senior membership
cost per month
Functionality:
Repeatedly display the menu with 4 option calling showMenu() functions.
Accept user’s choice.
If user enter number 1,2 or 3 then.
Ask for number of months.
Accept the input.
Call the showFees(double,int) method with selected membership rate and months.
Exit the program on selecting quit from menu (option 4).
Calls TO: showMenu() and showFees(double,int)
Sample Run:

⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide
1 out of 26
Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.