代写CSCI 14 Course Project, Baseball, Spring 2025代做C/C++编程

Spring 2025 CS 14 Individual Project

CSCI 14 Course Project, Baseball, 200 Points

Draft on 5/2/25, Final Expected on May 6 or May 7.

(This doc will be slightly revised after student feedback to include clarifications, improvements,

and more defined grading criteria. Assignment to be fully launched on May 7.)

Array of Struct with file input and output & Functions

The local baseball team is computerizing its records. You were asked to write a program that computes batting averages and other statistics.

There are 20 players on the team, identified by the numbers 1 through 20.

You will have two input files: (find them in Canvas).

You need to test run your program using those 2 files

(1)  A Roster File –

A file contains 21 lines, first line is an integer indicating the season. The rest is in the format “last name first name” (separated by a space) for each player, as follows:

2022

Smith  Sam

Jones  Bob

Miller  Miles         (20 names for 20 players)

and etc…..             (The players’ ID are numbered 1-20 in the order listed in this file.)

Noted: this file contains no player numbers, just their names. Assign the player ID while reading

(2) A Statistic File –

A separate file contains the game-by game statistics for the players as a “player ID number, hits, walks, outs”

3 4 3 0

9 7 3 0

11 4 2 2

9 1 1 1

3 5 2 8

and etc…….

Here is an example:

20   2   1   1

The example above indicates that during a particular game in the season, player number 20 was at bat four

times and made 2 hits, 1 walk, and 1 out.

There might be several lines in the file for a player. (a player can play more than one game in a season)

The file is organized by the batting line-ups (it is not sorted by player number).

Each player’s batting average is computed by adding the player’s total number of hits dividing by

the total number of times at bat.

A walk does not count as either a hit or a time at bat when the batting average is being calculated.

When your statistics file contains no data, print message to the output file saying, “The [2025] baseball season was cancelled” and end the execution.  [2025] is stored in a variable that was read from the Roster file.

Create an array of PlayerInfo struct to hold the players’ data. The array is local to main function and passes to other functions as argument.

struct PlayerInfo

{

int PlayerID;

string LastName; //struct declared in global area (above main & function prototypes)

string FirstName;

int Hits, Walks, Outs;

double Batting, OnBase;

};

PlayerInfo Player[20];          //array declared inside main function and pass it to sub functions.

GRADING POINTS will be given based largely on the BASE requirements and the PROGRAM EXECUTION requirements.

BASE Requirements: (All Functions must Be below the main function!!!)

Don’t use the following in your program at all: no vectors, no stacks, no multi-dimensional arrays, no parallel arrays or any other C++ coding techniques not covered by the Course. Significant number of points may be taken off

No global variables allowed. Global area can only have function prototypes, named constants, and struct declaration.

(your program must follow this logic)

Functions must be called in this order inside the main function.

1. In the main function, you will call a function GetPlayer to read from Roster file and store the player names and id into the array and return the year for the season.

int GetPlayer (PlayerInfo [ ] ); // function prototype

(Be careful!  The players’ identification numbers are 1 through 20, but C++ array index starts at 0).

2. Call a PrintRoster function to send the roster of the team with player ID in order to an output file

3. Call a SortPlayer function to sort players by last name. (i.e. Use Selection or Bubble Sort)

NOTE: The (index + 1) of the array is no longer the player’s ID after sorting.

4. Then call a GetStatistics function to read the statistics file, updating each player’s statistics of hits, walks and outs.

NOTE: – you need to keep the player identification numbers with the player names and the data in the struct.

When you read a player’s game line, look up the player in the array of structs before you adding up the hits, walks and outs.

Hints: use Linear (or Binary Search)Search to look up the player id, before adding hits, walks, and outs to that player.

if (ID = = Player[index].PlayerID)  {

Player[index].Hits += H;

Player[index].Walks += W;

Player[index].Outs += O;      }

5. A function to calculate each player’s batting average and on base average and store them into the array.

(remember to do casting in order to retain the factional part)

batting average = double (hits) / (hits + outs)

on base average = double (hits + walks) / (hits + walks + outs)

6. A function to Send the players’ statistic to the output file including their Batting Average, On Base Average, in DL list, the best hitter, the worst hitter, the best base runner (based on OBA) and the worst base runner.

Note: A player is in the DL (disabled list) if he didn’t play at all in the entire season.

Sample of an output file:

Baseball Season 2025

--------------------------------

Smith Sam Player 1

Jones Bob Player 2

Miller Miles Player 3

and etc……

Rutter Jack Player 20

Player Statistic with their total hits, total walks, total outs, batting and on base average for season 2025

Player Number Hits Walks Outs Batting Average On Base Average In Disable List

-------------------------------------------------------------------------------------------------------------------------------------------

Apbee Cory  5   5     3   5 0.50 0.62

Buzz Bee  8   3     0   0 1.00 1.00

Carter John  4 Yes

Crane David 19   3     4   4 0.43 0.64

and etc……

Give the name(s) and batting average of the best hitter (i.e. highest batting average).

Give the name(s) and on-base average of the best base runner

Give the name(s) and batting average of the worst hitter

Give the name(s) and on-base average of the worst base runner

If there is a tie for best or worst, Print all the players’ names.

Just an Example: (might not be true for your input file)

The best hitter with batting average of 0.68:  Jones

The worst hitter with batting average of 0.04: Miller, Smith

2) Program Execution Requirements: Possible adjustments to grade

Points included in 200 points, fully or partially deducted if not done or done partially.

You are required to use the provided dataset named statistic.txt and roster.txt and not only your own custom dataset, - 20 pts

Attach documentation of a screenshot of program compilation and execution, your choice of dataset with date/time included, - 20 pts

Attach the output file with the results of the program - 20 pts.  If you only print it to the screen you can lose up to 20 pts

If you provide any file names that have file paths (or are not just one filename), your program will be considered non-executable and you will receive a maximum of ONLY 100 points, with other possible deductions based on compilation and reviewing your code.

Points possible that can be added to 200 points (Considered extra credit, where this can help offset other points off or allow to get more than 20 points) there is some risk to choosing these options. If you don’t try this, it is ok, but you not received extra credit points.  If you try and it is not done well, you can receive minimal extra credit points or worse yet it can impact points on the other grading criteria.

Datasets Options:  Encourages you to use the file naming convention or file name entry

1) Use the provided datasets and one other custom dataset, specify the file names in two different .cpp files

a. Provided dataset file names are: statisticxx1.txt, rosterxx1.txt1 and resultsxx1 for the first .cpp file, +10 pts

b. This can only be done if you choose to do a test run also with a Custom dataset file names are: statisticxx1.txt, rosterxx2.txt2 and resultsxx2 for the first .cpp file, +10 pts

OR

2) Allows the user to enter the statistics, experts and output file names. +15 pts to +25 pt. You must attach all three files after the completion of each test run (for one test for the provided dataset +15 pts and two tests if you also run it for a custom dataset. +25 pts

No need to test your program more than one test for the provided dataset and one test for the custom dataset. You will not receive additional extra credit points.



热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图