subject

Python Instructions
The following instruction lists 5 steps to complete an inheritance approach to a sports team management program. Please carefully follow the steps to implement the program.

Part 1 - Creating the SportsTeam Base Class
(1) In the file named sportsteam. py create the SportsTeam class. It should contain the following properties: (2 pts)
name (String)
members (List of strings)
memberCount (Integer >= 0)

the constructor method should takes the above attributes as parameters. The parameters must all be made optional. The default value for the parameters should be an empty string, empty list, and 0 respectively.

(2) Create the following methods in the SportsTeam class: (4 pts)
add_member(member) adds a member name to the members list and increments memberCount.

remove_member(member) removes a member from the members list and decrements memberCount.

get_members() returns a list of all members in this SportsTeam.

search_member(member) searches for a given member in the team and returns true if the member is found in the team otherwise returns false.

__str()__ prints the following string:

The team [name] has currently [memberCount] members.
The team [name] has currently [memberCount] members.
Notes:
Calling remove_member() on a team with no members should not change the memberCount.

Calling remove_member() on a team that doesn't contain that member should not change the memberCount.

Calling remove_member() on a team that does contain that member should remove it from the list and decrement the memberCount by 1.

Part 2 - Creating the SoccerTeam Derived Class
(2) In the file named soccerteam. py first import the SportsTeam class. Then create a derived that inherits from SportsTeam. Call it SoccerTeam. It should contain the following additional properties: (2 pts)
goals (Integer >= 0)

(4) Create / override the following methods: (6 pts)
a constructor that takes all the calls the superclass's constructor's parameters in addition to a goals parameter default to 0.

score() increments goals by 1.

set_goals(goals) sets the total number of goals to the value given in the parameter.

get_goals() gets the teams current number of goals.

__str()__ should print the following string:

The team [name] has currently [memberCount] members. It scored [goals] goals.
The team [name] has currently [memberCount] members. It scored [goals] goals.
save_to_file(filename) writes the soccer team information into a text file named filename The report should include the team name, all the members' name, and total goals count. (format the text as you wish.)
Part 3 - Creating Unit Tests
(5) Write unit test cases to test the following methods (one unittest class for each) (6 pts):
search_member(member) write a separate test function for each of the following scenarios:

searching for a member in a team with no member
searching for a member that doesn't exist in the team
searching for a member that exists in the team

hint: you need to first create an object of SportsTeam class and add some members to it (using add_member method).

get_goals() write a separate test case for each of the following scenarios:

get the goals count for a team without any goals
get the goals count for team with some goals scroed (after calling the score method for couple of times)
get the goals count for team with some goals scroed (after calling the set_goals method once)

hint: you need to first create an object of SoccerTeam class.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:00
Create a word problem that involves calculating the volume and surface area of a three-dimensional object. cube: surface area 6 s2 , volume s3
Answers: 3
question
Computers and Technology, 22.06.2019 11:00
What is the foundation for proper monitoring, load balancing and routing in distributed systems
Answers: 3
question
Computers and Technology, 22.06.2019 18:10
Assume that to_the_power_of is a function that expects two int parameters and returns the value of the first parameter raised to the power of the second parameter. write a statement that calls to_the_power_of to compute the value of cube_side raised to the power of 3 and that associates this value with cube_volume.
Answers: 1
question
Computers and Technology, 25.06.2019 05:10
What is the disadvantage of a mesh topology?
Answers: 1
You know the right answer?
Python Instructions
The following instruction lists 5 steps to complete an inheritance appro...
Questions
question
Mathematics, 06.03.2020 19:15
Questions on the website: 13722360