A project to manage a baseball team's information (1) Create a program that lets the manager of a baseball team track th
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
A project to manage a baseball team's information (1) Create a program that lets the manager of a baseball team track th
Specifications PART 1 • Create a program that manages a team by storing data in a list of players. The list will be stored in the main method. • Use a list of lists to store each player in the lineup. The list for a single player includes their name, position, at bats, and hits. Example list with two players: lineupList = [[Trevor, 'SS', '588', '173']. [Garrett', '2B', '299', '74']] • For part 1 this list will be declared with a statement in the main method. Use functions to organize the code making it reusable, easy to read, and easy to maintain. Each of the functions for the six main menu features should take the list of players as an input parameter. Use a tuple to store all valid positions (*C', '1B', '2B¹, etc). • When entering/editing positions, the program should always require the user to enter a valid position. • The formula for calculating batting average is: average = hits/at_bats The program should round batting average to a maximum of three decimal places. If the user enters an invalid menu option, display an error message, and display the menu again so the user can clearly see the valid menu options. • Make sure the user can't enter data that doesn't make sense (such as a negative number of hits or the player having more hits than at bats). • Handle the exceptions that occur if the user enters a string where an integer is expected. Handle the exception that occurs if the user enters zero for the number of at bats.
PART 2 Use the BaseballPlayers.csv file that is on the assignment page as the source for the lineup. • Store the functions for writing to and reading from the file of players in a separate module named FileIO.py. Use the csv module for file I/O operations. The function that reads the file will return the list of players. The function that writes to the file will take a lineup list as the input parameter. • For part 2 replace the statement in the main method that declares the lineup list with a statement that calls the read method in the FileIO module. Call the FileIO module in any function that modifies the lineup list. Handle the exception that occurs if the program can't find the data file.
Use a top-down development process. For example, start by writing a main method that calls a function that prints the title. Test the program and fix any errors. Then add a function that prints the menu options, call the function from the main method, test it, and move on to the next feature. Get as much of the Part 1 functions completed before moving on to Part 2. Make sure that there is always a working version that can be turned in even if it is incomplete. Projects can require the use of material from any of the previous chapters covered in the textbook. Create a Team Management Python program that satisfies the specifications above. Put General Comments at the beginning of the project that includes (1) your name, (2) the project name, (3) the date, and (4) a description of the project. Turn in a ZIP file of the final version of the program. Include a Word document which contains output of the testing done on the program. The Word document must be inside the ZIP file. In the Comments section on the Assignment webpage, report (A) an estimate of the time it took to complete the project. Report a single value in minutes, and (B) a single rating of the project, on an ordinal scale, as either (1) Easy. (2) Moderate, (3) Hard, OR (4) Challenging.