I am going through and rechecking my work on a project and was hoping someone might see if I am on the right track. First off the project is as stated:

A baseball team manager wants a report showing her players' batting statistics. A batting average is computed as hits divided by at-bats, and it is usually expressed to three decimal positions (for example, .235). The output consists of a printed report titled TEAM STATISTICS. Fields printed on output are: player number, first name, last name, and batting average. The input file description is shown below:

File name: BASEBALL

FIELD DESCRIPTION DATA TYPE COMMENTS
Player Number Numeric 2 digits, 0 decimals
First Name Character 16 characters
Last Name Character 17 characters
At-bats Numeric never more than 999, 0 decimals
Hits Numeric never more than 999, 0 decimals

In my print chart (using the output fields given to me) I used X’s as the place holder for char variables and 9’s for num variables. Was I correct in my usage of these?

When writing my pseudocode I declare my variables in a module called housekeeping(). We are currently working on reading input from a file or files rather than asking the user directly for input. I am a bit confused how this might work with my pseudocode though. I know how I might write it out but am unsure of the file I am pointing to. In this project I would need to point to the file which contains the player’s number, name, etc.. The print chart is an output file so it would not come from there. Where and how might I include the fictitious input needed for the program to run?

Lastly, when declaring your variables and including a column header with defined character spaces, do you space according to that? For example:
inputFileName
num playerNumber
char firstName
char lastName
num atBats
num hits
char mainHeading = “TEAM STATISTICS”
char columnHead = “PLAYER NUMBER FIRST NAME LAST NAME BATTING AVERAGE”

In the line above would you space twice after player number and 16 spaces after first name because that is how many char spaces are allotted? Or is it just spacing enough between the headings to allow everything to fit and look nicely?

Thanks for every ones input!

When writing my pseudocode I declare my variables in a module called housekeeping(). We are currently working on reading input from a file or files rather than asking the user directly for input. I am a bit confused how this might work with my pseudocode though. I know how I might write it out but am unsure of the file I am pointing to. In this project I would need to point to the file which contains the player’s number, name, etc.. The print chart is an output file so it would not come from there. Where and how might I include the fictitious input needed for the program to run?

Open input file [I]X[/I].  Read from [I]X[/I]
Open output file [I]Y[/I].  Write to [I]Y[/I]

Basically, that's all you need for terminology.

char columnHead = “PLAYER NUMBER FIRST NAME LAST NAME BATTING AVERAGE”

In the line above would you space twice after player number and 16 spaces after first name because that is how many char spaces are allotted? Or is it just spacing enough between the headings to allow everything to fit and look nicely?

Leave enough space for your field size plus a couple characters between columns.

This question has already been answered. Start a new discussion instead.