CS192 Grantham WeeK5 Coding: Team Management OOP Style Assignment

User Generated

fbpprezbz2012

Programming

CS192

Grantham University

Description

I coded a program for a team management roster last week. This week I need to convert my list to dictionary and while loop to for loop.

Team Management OOP Style

Your program for keeping track of team members is coming along, but now you want to be able to include phone numbers and jersey numbers along with your team member’s name. Modify your program from week 4 so that the program utilizes object-oriented programming to create a member object which can accept the player’s name, phone number, and jersey number. You will need to replace the list with a dictionary to help in locating objects for removal and editing. Again, File Access for long-term storage is not required for this assignment.

For this project:

  • You will submit your python code in either the original .py file, or copied into a .txt file.
  • A screenshot of your code having been executed (run). How to Take a Screenshot

Tips: While dictionaries resemble lists, remember that they are not the same! It is better to use FOR loops, not WHILE loops with index values.

Your class structure does not need a full set of accessor and mutator methods getName(), setName(newName), however it they will be helpful in the next week.

Unformatted Attachment Preview

print('Welcome to the Team Manager') memberList = [] while True: print('===========Main Menu===========') print('1. Display Team Roster.') print('2. Add Member.') print('3. Remove Member.') print('4. Edit Member.') print('9. Exit Program.') choice = input('Selection > ') i = 0 if choice == '1': for i in range(len(memberList)): print(memberList[i], " ") elif choice == '2': name = input("Enter new member name: ") memberList.append(name) phone = input("Enter new member's phone number: ") memberList.append(phone) jersey = input("Enter new member's jersey number: ") memberList.append(jersey) elif choice == '3': name = input('Enter member name to be removed: ') memberList.remove(name) memberList.remove(phone) memberList.remove(jersey) elif choice == '4': name = input('Enter the name of the member you want to edit: ') while True: \ print("===========Edit Member Menu===========") print("4.1 Change Name of Member") print("4.2 Change Member's Phone Number.") print("4.3 Change Member's Jersey Number.") print("4.4 Return to Main Menu") choice = input('Selection > ') if choice == '4.1': newName = input("Enter the new name of the member: ") if choice == '4.2': newPhone = input("Enter player's new phone number: if choice == '4.3': newJersey = input("Enter player's new jersey number: ") if choice == '4.4': break for i in range(len(memberList)): if memberList[i] == name: memberList[i] = newName if memberList[i] == phone: memberList[i] = newPhone if memberList[i] == jersey: memberList[i] = newJersey elif choice == '9': print("Exiting program....") exit() ")
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Hi buddy, i have fin...


Anonymous
Great! Studypool always delivers quality work.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags