CSCI 360 | Spring 2014 |
For this program, expand on Program 1 by writing and executing a program that will calculate the points for multiple hockey players.
The input for the program will come from a file with an unknown number of records, each of which represents a single hockey player. Each record contains two numbers that are separated by at least one space:
The processing for this program will utilize a read loop to process all of the records (players) in the input file.
For each player:
calculate the number of points earned using the formula from Program 1:
points earned = number of goals scored + number of assists earned
display a player number (value that ranges from 1 to however many players are in the file: 1 for the first player, 2 for the second player, etc...), the number of goals scored, the number of assists earned, and the calculated number of points for the player
After all of the player information has been displayed, display the number of players and the total number of points for all of the players.
The following is suggested Logic for this program:
Initialize any counters or totals that are needed Read the first input record While there are input records Get the 2 pieces of information from the input file Calculate the number of points Build and display the print line Increment the number of players and the total number of points Read the next input record Endwhile Display the number of players and the total number of points
Using Blackboard, hand in copy of the source code *AND* a copy of a run of this program from the Marist system.
Use TITLE 'Your Name, Class, Section, Assignment Number'.
Use XREAD, XPRNT, XDECI, and XDECO for Input/Output operations.
Include Line Documentation (known as 'Line Doc') following the operands on all lines. This is in addition to the prescribed Documentation Box (known as 'Doc Box') that you must provide at the start of every program.
Write (XPRNT) a "top of page header" that says 'Hockey Player Information'. Use the following Carriage Control Characters to position the lines of output:
C'1' (one) ----- Top of Page C' ' (blank) --- Single Space C'0' (zero) ---- Double Space C'-' (minus) --- Triple Space
The column header should be double spaced from the "top of page header". The player information should be double spaced. The first line of summary information (number of players) should be triple spaced from the last line of player information. The second line of summary information (total number of points) should be single spaced from the first.
Include the following JCL statement to access the input file:
//FT05F001 DD DSN=KC02330.CSCI360.FILES(DATA2),DISP=SHR
The JCL for the program should now look like:
//your_KC_id_plus_a_letter JOB ,'your name',MSGCLASS=H //STEP1 EXEC PGM=ASSIST //STEPLIB DD DSN=KC02293.ASSIST.LOADLIB,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSIN DD * ******************************************** * * The program goes here * ******************************************** /* //FT05F001 DD DSN=KC02330.CSCI360.FILES(DATA2),DISP=SHR //
When you are debugging logic errors, don't be reluctant to use XDUMP instructions to display registers and/or memory. Once you get the program running, remove the XDUMPs from the run that is turned in for grading.
Feel free to test the program with your own data. Simply leave out the FT05F001 statement in the JCL that was given above and place your data after the assembly END statement. It is important that the data you enter follows the same format as the grade run input file. For example:
END MAIN 172 308 214 226 184 236 /* //
Make sure that the run you hand in for grading uses the file specified above and contains nothing after the END statment.
The output should be neatly formatted and the heading(s) should be centered over the output columns. SAMPLE OUTPUT FOLLOWS based on data consisting of only the first three input records:
Note: As below, the output should have the carriage control characters rather than blank lines.
1 Hockey Player Information 0 Player # Goals Assists Points 0 1 172 308 480 0 2 214 226 440 0 3 184 236 420 - Number of players: 3 Total Number of points: 1340