In: Computer Science
Case Study Baseball Team Manager
For this case study, you’ll use the programming skills that you learn in Murach’s Python Programming to develop a program that helps a person manage a baseball team. This program stores the data for each player on the team, and it also lets the manager set a starting lineup for each game.
After you read chapter 2, you can develop a simple program that calculates the batting average for a player. Then, after you complete most of the other chapters, you can enhance and improve this program. 1
General guidelines
Naming
When creating the folder and file names for your programs, please use the conventions specified by your instructor. Otherwise, for a program that consists of a single file, use this naming convention: first_last_baseball_wkXX.py where first_last specifies your first and last name and wkXX specifies the chapter number, as in wk05. For programs that have multiple files, store the files in a folder named first_last_baseball_wkXX.
When creating names for variables and functions, please use the guidelines and recommendations specified by your instructor. Otherwise, use the guidelines and recommendations specified in Murach’s Python Programming.
User interfaces
You should think of the user interfaces that are shown for the case studies as starting points. If you can improve on them, especially to make them more user-friendly, by all means do so.
Specifications
You should think of the specifications that are given for the case studies as starting points. If you have the time to enhance the programs by improving on the starting specifications, by all means do so.
Top-down development
Always start by developing a working version of the program. That way, you’ll have something to show for your efforts if you run out of time. Then, you can build out that version of the program until it satisfies all of the specifications.
From chapter 5 on, you should use top-down coding and testing as you develop your programs. You might also want to sketch out a hierarchy chart for each program as a guide to your top-down coding.
Improve number and string formatting
Update the program to improve the formatting of the numbers and the strings.
Console
================================================================
Baseball Team Manager
MENU OPTIONS
1 – Display lineup
2 – Add player
3 – Remove player
4 – Move player
5 – Edit player position
6 – Edit player stats
7 - Exit program
POSITIONS
C, 1B, 2B, 3B, SS, LF, CF, RF, P
================================================================
Menu option: 1 |
POS |
AB |
H |
AVG |
Player |
----------------------------------------------------------------
1 |
Denard Span |
CF |
545 |
174 |
0.319 |
2 |
Brandon Belt |
1B |
533 |
127 |
0.238 |
3 |
Buster Posey |
C |
535 |
176 |
0.329 |
4 |
Hunter Pence |
RF |
485 |
174 |
0.359 |
5 |
Brandon Crawford |
SS |
532 |
125 |
0.235 |
6 |
Eduardo Nunez |
3B |
477 |
122 |
0.256 |
7 |
Joe Panik |
2B |
475 |
138 |
0.291 |
8 |
Jarrett Parker |
LF |
215 |
58 |
0.270 |
9 |
Madison Bumgarner |
P |
103 |
21 |
0.204 |
Menu option: 7
Bye!
!!Specifications !! (Question that needs to be answered
Use the multiplication operator to make sure that horizontal separator lines use 64 characters
Use spaces, not tabs, to align columns. This should give the program more control over how the columns are aligned.
Make sure the program always displays the batting average with 3 decimal places. Display the positions by processing the tuple of valid positions.