[Solved]Case Study Baseball Team Manager Case Study Ll Use Programming Skills Learn Murach S Pytho Q37276474
Case Study Baseball TeamManager
For this case study, you’ll use the programming skills that youlearn in Murach’s Python Programming to develop aprogram that helps a person manage a baseball team. This programstores the data for each player on the team, and it also lets themanager set a starting lineup for each game.
After you read chapter 2, you can develop a simple program thatcalculates the batting average for a player. Then, after youcomplete most of the other chapters, you can enhance and improvethis 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 namingconvention: first_last_baseball_wkXX.py wherefirst_last specifies your first and last name andwkXX specifies the chapter number, as in wk05. Forprograms that have multiple files, store the files in a foldernamed first_last_baseball_wkXX.
When creating names for variables and functions, please use theguidelines and recommendations specified by your instructor.Otherwise, use the guidelines and recommendations specified inMurach’s Python Programming.
User interfaces
You should think of the user interfaces that are shown for thecase 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 thecase studies as starting points. If you have the time to enhancethe programs by improving on the starting specifications, by allmeans do so.
Specifications (Question that needs to beanswered)
Handle the exception that occurs if the program can’t find thedata file.
Handle the exceptions that occur if the user enters a stringwhere an integer is expected.
Handle the exception that occurs if the user enters zero for thenumber of at bats.
What I have so far
def display_menu():
print(“======================================================================”)
print(” Baseball Team Manager”)
print(“MENU OPTIONS”)
print(“1 – Enter Players details”)
print(“2 – Calculate batting average”)
print(“3 – Select players for a Game”)
print(“4 – Diaplay the selected players”)
print(“5 – Exit program”)
print(“=====================================================================”)
def convert_bat():
print(“Calculate batting average for the players list…”)
#Calculate Batting average for all theplayers
for single_player in players_list:
print(“Batting average for %s is %d” % (single_player[0],single_player[2]/single_player[3]))
def player_details():
#get how many playerts needs to be added and theirrespective information
count = int(input(“How many players information needs to be added:”))
while count > 0:
local_list=[]
local_list.append(str(input(“Name: “)))
players_only.append(local_list[0])
local_list.append(str(input(“position: “)))
local_list.append(int(input(“Atbats: “)))
local_list.append(int(input(“Hits: “)))
count = count – 1
players_list.append(local_list)
def select_player():
num_players=len(players_only)
print(“Total number of players available is %d and select from thelist is given below” % num_players)
#select the player until we press -1
while True:
for i in players_only:
print(i)
selecting=int(input(“Enter the player number or -1 to quit:”))
if selecting == -1:
print(“selection completed.. Quitting”)
break
if players_only[selecting-1] in selected_players:
print(“%s Player number already selected” % selecting)
else:
#append the selected_players list with the selected players
selected_players.append(players_only[selecting-1])
def display_selection():
#display the selected players
print(“List of selected players:”)
for i in selected_players:
print(i)
def main():
while True:
display_menu()
ch = int(input(“Menu Option : “))
if(ch == 1):
player_details()
elif(ch == 2):
convert_bat()
elif(ch == 3):
select_player()
elif(ch == 4) :
display_selection()
elif(ch == 5):
break
print(“Bye!”)
else:
print(“Not a valid option. Please try again.”)
main()
it should look like this below
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
Team data file could not be found.
You can create a new one if youwant.
================================================================
Menu option: 2
Name: Mike
Position: SS
At bats: 0
Hits: 0
Mike was added.
Menu option: X
Not a valid option. Please tryagain.
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
Menu option: 7
Bye!
Expert Answer
Answer to Case Study Baseball Team Manager For this case study, you’ll use the programming skills that you learn in Murach’s P… . . .
OR

