944,188 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 2200
  • C++ RSS
Nov 19th, 2007
0

Quick pseudocode question for anyone who might be able to help...

Expand Post »
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!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Butterflieq is offline Offline
7 posts
since Nov 2007
Nov 19th, 2007
0

Re: Quick pseudocode question for anyone who might be able to help...

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 X.  Read from X
Open output file Y.  Write to Y
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.
Moderator
Reputation Points: 3281
Solved Threads: 896
Posting Sage
WaltP is offline Offline
7,753 posts
since May 2006
Nov 19th, 2007
0

Re: Quick pseudocode question for anyone who might be able to help...

Thanks WaltP! I appreciate your help and how expedient you answered! =)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Butterflieq is offline Offline
7 posts
since Nov 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Help with finding a good use for a hash table in my program....
Next Thread in C++ Forum Timeline: Parent / child class problems





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC