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

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Nov 2007
Posts: 5
Reputation: Butterflieq is an unknown quantity at this point 
Solved Threads: 0
Butterflieq's Avatar
Butterflieq Butterflieq is offline Offline
Newbie Poster

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

 
0
  #1
Nov 19th, 2007
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!
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 3,114
Reputation: WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of 
Solved Threads: 281
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Sensei

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

 
0
  #2
Nov 19th, 2007
Originally Posted by Butterflieq View Post
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.

Originally Posted by Butterflieq View Post
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.
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 5
Reputation: Butterflieq is an unknown quantity at this point 
Solved Threads: 0
Butterflieq's Avatar
Butterflieq Butterflieq is offline Offline
Newbie Poster

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

 
0
  #3
Nov 19th, 2007
Thanks WaltP! I appreciate your help and how expedient you answered! =)
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC