Sample Console Output Baseball Team Manager CURRENT DATE: 2020-07-12 GAME DATE: DAYS UNTIL GAME: 7 2020-07-19 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 с, 1в, 2в, зв, ss, LP, CP, RP, P Menu option: 1 Player POS AB AVG 1 Dominick Gilbert 2 Craig Mitchell 3 Jack Quinn 4 Simon Harris 5 Darryl Moss 6 Grady Guzman 7 Wallace Cruz 8 Cedric Cooper 9 Alberto Gomez 1B СР 545 396 170 125 0.317 0.316 RF 345 450 99 135 0.287 0.300 3B 501 120 0.240 SS LF 463 443 114 131 0.246 0.296 2B 165 72 54 19 0.327 0.264 Menu option: General Specifications Use a Player class that provides attributes that store the playerID, batOrder, first name, last name, position, at bats, and hits for a player. The class constructor should use these seven attributes as parameters. This class should also provide a method that returns the full name of a player and a method that returns the batting average for a player. • The playerlID is not used when adding a player to the lineup. A PlayerID, the primary key for the Player table, is automatically created by the database. • Use a Lineup class to store the lineup for the team as a list of player objects. This class should include methods with appropriate parameters that allow you to add, remove, move, and edit a player. In addition, it should include an iterator so you can easily loop through each player in the lineup. A Lineup object replaces the list that holds all players. Use the same console Input/output system that was used in project 3. The file for this system will be named UI. • Use a file named Objects to store the code for the Player and Lineup classes. Use a file named DB to store the functions that work with the file that stores the data. A db_comments.py file is included as a template for the DB file that must be turned in.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

#Fill in comments to spec.

import sqlite3
from contextlib import closing

from Objects import Player, Lineup

conn = None


def connect():
global conn
if not conn:
DB_FILE = "player_db.sqlite"
conn = sqlite3.connect(DB_FILE)
conn.row_factory = sqlite3.Row


def close():
if conn:
conn.close()


def get_players():

return None #remove this line when code is added.
# SQL statement to select all 7 fields for all players

# Use a with statement to execute the query

# Create a lineup object
# use a loop to populate the lineup object with player objects
# return the lineup object

 

def get_player(playerID):
return None #remove this line when code is added.
# SQL statement to select all 7 fields for a player

# Use a with statement to execute the query & return a player object if the player exists


def add_player(player):
return None #remove this line when code is added.
# SQL statement to insert 6 fields for a player added to the table

# Use a with statement to execute the query


def delete_player(player):
return None #remove this line when code is added.
# SQL statement to delete a single player


# Use a with statement to execute the query

 

def update_bat_order(lineup):
return None #remove this line when code is added.
# Use a loop to call a SQL statement that updates
# the batOrder for each player based on their playerID

# Use a with statement to execute the query


def update_player(player):
return None #remove this line when code is added.
# SQL statement to update 6 fields of a player based on the playerID

# Use a with statement to execute the query


def main():
# code to test the get_players function
connect()
players = get_players()
if players != None:
for player in players:
print(player.batOrder, player.firstName, player.lastName,
player.position, player.atBats, player.hits, player.getBattingAvg())
else:
print("Code is needed for the get_players function.")

if __name__ == "__main__":
main()

Sample Console Output
Baseball Team Manager
CURRENT DATE:
2020-07-12
GAME DATE:
2020-07-19
DAYS UNTIL GAME: 7
MENU OPTIONS
1 - Display lineup
2 - Add player
3 - Remove player
4 - Move player
5 - Edit player position
6 - Edit player stats
Exit program
7
POSITIONS
с, 1в, 2в, зв, ss, LF, СЕ, RF, P
Menu option:
Player
POS
AB
H
AVG
Dominick Gilbert
1B
545
170
0.317
2 Craig Mitchell
Jack Quinn
Simon Harris
CF
396
125
0.316
0.287
3
RF
345
99
4
450
135
0.300
5 Darryl Moss
6 Grady Guzman
7 Wallace Cruz
Cedric Cooper
ЗВ
501
120
0.240
463
114
0.246
443
131
0.296
8
2B
165
54
0.327
Alberto Gomez
72
19
0.264
Menu option:
General Specifications
Use a Player class that provides attributes that store the playerID, batOrder,
first name, last name, position, at bats, and hits for a player. The class
constructor should use these seven attributes as parameters. This class should
also provide a method that returns the full name of a player and a method that
returns the batting average for a player.
The playerlD is not used when adding a player to the lineup. A PlayerlD, the
primary key for the Player table, is automatically created by the database.
• Use a Lineup class to store the lineup for the team as a list of player objects. This
class should include methods with appropriate parameters that allow you to add,
remove, move, and edit a player. In addition, it should include an iterator so you
can easily loop through each player in the lineup. A Lineup object replaces the list
that holds all players.
Use the same console Input/output system that was used in project 3. The file for
this system will be named UI.
• Use a file named Objects to store the code for the Player and Lineup classes.
• Use a file named DB to store the functions that work with the file that stores the data. A
db_comments.py file is included as a template for the DB file that must be turned in.
Transcribed Image Text:Sample Console Output Baseball Team Manager CURRENT DATE: 2020-07-12 GAME DATE: 2020-07-19 DAYS UNTIL GAME: 7 MENU OPTIONS 1 - Display lineup 2 - Add player 3 - Remove player 4 - Move player 5 - Edit player position 6 - Edit player stats Exit program 7 POSITIONS с, 1в, 2в, зв, ss, LF, СЕ, RF, P Menu option: Player POS AB H AVG Dominick Gilbert 1B 545 170 0.317 2 Craig Mitchell Jack Quinn Simon Harris CF 396 125 0.316 0.287 3 RF 345 99 4 450 135 0.300 5 Darryl Moss 6 Grady Guzman 7 Wallace Cruz Cedric Cooper ЗВ 501 120 0.240 463 114 0.246 443 131 0.296 8 2B 165 54 0.327 Alberto Gomez 72 19 0.264 Menu option: General Specifications Use a Player class that provides attributes that store the playerID, batOrder, first name, last name, position, at bats, and hits for a player. The class constructor should use these seven attributes as parameters. This class should also provide a method that returns the full name of a player and a method that returns the batting average for a player. The playerlD is not used when adding a player to the lineup. A PlayerlD, the primary key for the Player table, is automatically created by the database. • Use a Lineup class to store the lineup for the team as a list of player objects. This class should include methods with appropriate parameters that allow you to add, remove, move, and edit a player. In addition, it should include an iterator so you can easily loop through each player in the lineup. A Lineup object replaces the list that holds all players. Use the same console Input/output system that was used in project 3. The file for this system will be named UI. • Use a file named Objects to store the code for the Player and Lineup classes. • Use a file named DB to store the functions that work with the file that stores the data. A db_comments.py file is included as a template for the DB file that must be turned in.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Query Syntax
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education