Lab Chapter 3 Athlete Pay Roster
Variables and Computations
Check List
/ Create Task List and define flowchart symbols / Draw flowchart and add pseudocode
/ Draw user interface and name objects
/ Fill out object property sheet
/ Code problem
/ Comment your code to make it easier to update
/ Print code, form as graphic and form as text
Problem Athlete Pay Roster
- Use the example of the user interface as a guide, create a program that opens a data file called Sports.txt and captures the records of four athletes.
- For each athlete you will get the Athlete’s name, sport, annualsalary, and the endorsements pay.
- Calculate the total compensation for the athlete and display it in a text box provided on the screen.
- Formatted to display as currency with no decimals.
Declare all attributes as class-level variables, this concept is explained on page 78. Open the data file so that records will be added to any existing data already in the file. Use the App.Path and the file name to store the name of your data file in a modular level variable. Use your declared variable in the open statement.
Use a command button click event to write a procedure that will write four records into the Sports.txt file. This procedure should also clear the text boxes on the input form and reset the focus so that the cursor is in the Athlete’s Name box awaiting the next record.
The Report
After you have collected all your data, use a command button click event to display your data as a report in the picture box at the bottom on the user interface. Open the file in the appropriate mode for reading the records to be displayed. Remember to clear out the picture box with the cls method each time the report is run. Include two headers: the title “2014 Athlete Pay Roster” will appear at the top of the report, include your name and the date on the second line. Both headers should appear as bold using 10-font size. Use commas in the output to separate the fields into columns in the report. Include a column header to explain the data and display the data directly beneath each column heading. When the report procedure has finished reading all the records it should close the data file.
Use the data in the above table for your data. Remember to use the option explicit statement.