SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 314 Weeks Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 30 Nov 2017 My Price 10.00

program for keeping track of team members is coming

How do I replace?

Programming Essentials

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.

# managing the softball team

 

memberList = []

def memberadd(membername):

      if membername in memberList:

            print ('Can\'t add because memmber already exists.\n')

      else:

            memberList.append(membername)

 

def memberremove(membername):

      if membername in memberList:

            memberList.remove(membername)

      else:

            print('Can\'t remove because member doesn\'t exist.\n')

 

def memberedit(membername):

      if membername not in memberList:

            print('Can\'t edit because member doesn\'t exist\n')

      else:

            i = memberList.index(membername)

            tname = input('Enter the new name of the member: ')

            if tname not in memberList:

                  memberList[i] = tname

            else:

                  print ('Can\'t replace with already existing player\n')

 

def displayroster():

      print('\n')

      if len(memberList) == 0:

            print ('No members are in roster\n')

      for member in memberList:

            print(member)

      print ('\n')

 

print ('Welcome to the Team Manager\n')

user_input = '-1'

while (user_input != '9'):

      print('==========Main Menu==========')

      print ('\n1. Display Team Roster')

      print ('2. Add member')

      print ('3. Remove member')

      print ('4. Edit member')

      print ('9. Exit program')

      user_input = input('Selection> ')

      if (user_input == '1'):

            displayroster()

      elif (user_input == '2'):

            membername = input ('Enter new member\'s name: ')

            memberadd(membername)

      elif (user_input == '3'):

            membername = input ('Enter member name to be removed: ')

            memberremove(membername)

      elif (user_input == '4'):

            membername = input ('Enter the name of the member you want to edit: ')

            memberedit(membername)

      elif (user_input == '9'):

            print ('Exiting Program...')

Answers

(5)
Status NEW Posted 30 Nov 2017 06:11 AM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)