Question: QUESTION FIVE (Total: 25 marks): Objects and Sharing a) (11 marks). The following questions relate to the NetballTeam class below: class NetballTeam () : teamSize

QUESTION FIVE (Total: 25 marks): Objects and Sharing a) (11 marks). The

QUESTION FIVE (Total: 25 marks): Objects and Sharing a) (11 marks). The following questions relate to the NetballTeam class below: class NetballTeam () : teamSize = 7 squadSize = 12 sport = "Netball" validPos = {"GS", "GA", "WA", "C", "WD", "GD", "GK"} def init (self, name, coach) : self . name = name self. coach = coach self . players = { } # List of players mapped to list of # preferred positions def str_(self) : return self . name + ": " + self. sport i) (5 marks) Write a method addPlayer(name, prefPos), for the class, taking in the name of the player and their preferred positions (a list of strings, e.g. ["GS","GA"]). You should check that adding a player stays within the squadSize, and throw a SquadOverflow exception if it doesn't. ii) (3 marks) Write a method addPlayerPos(name, pos), for the class, taking in the name of the player and the position to add

QUESTION FIVE (Total: 25 marks): Objects and Sharing a) (11 marks). The following questions relate to the NetballTeam class below: class Netball Team (): teamSize = 7 squadSize = 12 sport validPos = = "Netball" {"GS", "GA", "WA", "C", "WD", GD", "GK"} def de f init (self, name, coach) : self.name = name self.coach = coach self.players {}} = str (self): return self.name + ": # List of players mapped to list of # preferred positions + self.sport i) (5 marks) Write a method addPlayer(name, prefPos), for the class, taking in the name of the player and their preferred positions (a list of strings, e.g. ["GS","GA"]). You should check that adding a player stays within the squadSize, and throw SquadOverflow exception if it doesn't. ii) (3 marks) Write a method addPlayerPos(name, pos), for the class, taking in the name of the player and the position to add.

Step by Step Solution

3.48 Rating (164 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a Here is the modified code for the NetballTeam class with the addPlayer and addPlayerPos methods implemented python class SquadOverflowException pass class NetballTeam teamSize 7 squadSize 12 sport N... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!