Question: Step 1 - Section 1: program that lets the manager of a baseball team keep the data for each player and also specify and display
Step 1 - Section 1: program that lets the manager of a baseball team keep the data for each player and also specify and display the lineup for a baseball game. 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: 2 Name: Mike Position: c At bats: 11 Hits: 4 Mike was added. Menu option: 1 Player POS AB H AVG ---------------------------------------------------------------- 1 Denard CF 545 174 0.319 2 Joe 2B 475 138 0.291 3 Buster C 535 176 0.329 4 Hunter RF 485 174 0.359 5 Brandon SS 532 125 0.235 6 Eduardo 3B 477 122 0.256 7 Brandon 1B 533 127 0.238 8 Jarrett LF 215 58 0.27 9 Madison P 103 21 0.204 10 Mike C 11 4 0.364 Menu option: 3 Number: 10 Mike was deleted. Menu option: 4 Current lineup number: 8 Jarrett was selected. New lineup number: 2 Jarrett was moved. Menu option: 5 Lineup number: 1 You selected Denard POS=CF Position: lf Denard was updated. Menu option: 7 Bye!
The formula for calculating batting average is: average = hits / at_bats
Step 2 - Section 2: Improve the program Use the skills you learned in section 2 to improve this program. This should improve the appearance of the console and the readability of the code. Console ================================================================ Baseball Team Manager CURRENT DATE: 2016-12-19 GAME DATE: 2016-12-21 DAYS UNTIL GAME: 2 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 Player POS AB H AVG ---------------------------------------------------------------- 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
Use the multiplication operator to display separator lines that use 64 characters. Use a dictionary to store the data for each player. To get this to work, you need to modify the functions that read and write the data to the file so they work correctly with a list of dictionaries
Step 3 -
Section 3: Convert the Baseball Team Manager program from procedural to object-oriented. This shouldn't change the functionality of the code much, but it should make the code more modular, reusable, and easier to maintain. Console ================================================================ Baseball Team Manager CURRENT DATE: 2016-12-19 GAME DATE: 2016-12-21 DAYS UNTIL GAME: 2 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 Player POS AB H AVG ---------------------------------------------------------------- 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: 2 First name: Mike Last name: Murach Position: c At bats: 0 Hits: 0 Mike Murach was added. Menu option: 7 Bye!
Step 4 - Section 4: Use a database and a GUI Use a database to store the data for the Baseball Team Manager program. SQLite Manager with the Player table displayed Specifications Use SQLite Manager to make new database for the program. Use a single table named Player to store the data for the lineup of players. Here's a SQL statement that defines the columns and their data types for this table: CREATE TABLE Player( playerID INTEGER PRIMARY KEY NOT NULL, batOrder INTEGER NOT NULL, firstName TEXT NOT NULL, lastName TEXT NOT NULL, position TEXT NOT NULL, atBats INTEGER NULL, hits INTEGER NULL ); To create the Player table, use SQLite's Execute SQL tab to run this CREATE TABLE statement. Modify the db module so it provides all functions necessary to work with the player data. This should include functions for reading all players, adding a player, deleting a player, updating the batting order for all players, and updating the data for a player. To update multiple columns for a single row, you can use a SQL statement like this: UPDATE Player SET position = ?, atBats = ?, hits = ? WHERE playerID = ?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
