Lab 9
Testing Video Lab 9
For this project you may create your own interface or use the one provided
in the Shell folder on the Content tab in Angel. If you use the shell "make it your own" by changing colors, fonts, and/or rearrange
the layout.

Keeping Fit Fitness Center
The purpose of this part of the assignment is to call a
general procedure from multiple places
in a program to calculate a monthly fee.
You will not use a command button. Instead every time the
user clicks either a radio button or check box you are
to calculate and display the monthly fee in a Label. The fee will be determined
as follows.
-
Individual membership is $30. This is the default
-
Family membership is $50.
-
Corporate membership is $25.
-
An additional $100 a month will be charged for the use of a personal trainer.
-
An additional $40 a month will be charged for you to make use of the child care
facilities.
The default individual membership fee of $30 will be initially displayed. Every
time the user selects or deselects a membership option or added feature you are to call a
general procedure that will recalculate and display the fee.
Hints to Calculate Fitness Fee:
You will NOT be passing any values to procedures to complete
this part of the assignment.
You will have a Click event for each check box and radio
button. Each event will have only one statement – That statement will call a
general procedure that calculates and displays the membership fee. There will be
only 1 general procedure.
Keep in mind that whether a person chooses to pay for a
personal trainer or childcare or not is not related to which kind of membership
they want. And that a person may choose to make use of a personal trainer,
childcare, both or neither. The fee determination can be accomplished with an
accumulator and three separate but relatively simple If statements.
Since the Individual radio button’s TabIndex property is = 0
it will receive focus when the Form loads and the Checked property will be
automatically set to True (as if you clicked on it). Because the Click event for
a radio button is invoked when ever the value of that radio button’s Checked
property is changed to True the fee will be automatically calculated and
displayed when the Form loads.
Calculate Pay
This part of the program will make use of
programmer defined
functions and procedures and will
pass arguments
to procedures both by value and by reference. IMPORTANT:
No reference may be made to any input or output control other than in the Event
procedures and Message Boxes may only be displayed in the Click event. ALSO: No class level variables are
allowed.
Validation
The Employee Id is a required field. It may contain any
character
Use a Function
to validate hours worked
-
Hours worked must be numeric, >= zero and <= 60
-
The Function will return a Boolean value indicating if the
input was valid or not.
-
The Function may NOT reference the textboxes (you must pass
appropriate values to the procedure)
Use a Function to validate sales
-
Sales amount must be numeric and >= 0
-
The Function will return a Boolean value indicating if the
input was valid or not.
-
The Function may NOT reference the textboxes (you must
pass appropriate values to the procedure)
Focus must return to invalid input after displaying an
appropriate error message.
If all input is valid
Call a procedure to calculate pay based on hours worked
-
The called procedure may NOT reference the textboxes (you
must pass appropriate values to the procedure)
-
The first 40 hours will be paid at $10 an hour. Hours beyond
40 will receive time-and-a-half pay.
Call a procedure to calculate pay based on commission
-
The called procedure may NOT reference the textboxes (you
must pass appropriate values to the procedure)
-
30% commission is paid if sales >= 2000 and 28% if it is not.
The final gross pay will be the greater of the two --- hourly
pay or commission.
Hints for Calculate Pay:
Flowchart for Validate Hours
Function. The function to validate the sales will be very similar to
the validate hour function. You will use the validating function the same way
that you have been using the IsNumeric function.
When you have called the IsNumeric() function in previous
programs you passed to that function the contents of the input textbox. The
function looked at the string value passed to it, determined whether or not
the string contained a number, and Returned an appropriate Boolean value. The
value returned from IsNumeric was used in a condition.
If IsNumeric(txtbox.Text) =
False Then
:
:
your validating functions will behave in a similar way. The
only real difference is that in addition to testing to ensure the input value
was numeric both function will also test to see if the value is within
appropriate ranges.
Flowchart for the Sub procedures
to calculate hourly pay. The program must pass the number of
hours worked and a variable that will hold the hourly pay value to the procedure
that calculates the gross pay based on hours worked. Since the value in hours
worked will not be altered in the called procedure it's value will be passed
ByVal. Since the gross pay value will be needed in the main procedure (CalculatePay)
to be compared to the gross pay by commission it must be passed ByRef.
The Sub procedure to calculate pay bases on sales will be
similar to the Sub procedure that calculates pay based on hours worked.
When you are confident the program works
Submit a zipped folder(s) containing the entire project(s) as an attachment in the
appropriate drop box.