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 22:40
Write a program that defines symbolic names for several string literals (chars between quotes). * use each symbolic name in a variable definition. * use of symbolic to compose the assembly code instruction set can perform vara = (vara - varb) + (varc - vard); ensure that variable is in unsigned integer data type. * you should also further enhance your symbolic logic block to to perform expression by introducing addition substitution rule. vara = (vara+varb) - (varc+vard). required: debug the disassembly code and note down the address and memory information.
Answers: 3
question
Computers and Technology, 23.06.2019 00:00
What season was better from fortnite?
Answers: 2
question
Computers and Technology, 23.06.2019 20:00
How much current flows through the alternator brushes? a. 2โ€“5 a b. 25โ€“35 a, depending on the vehicle c. 5โ€“10 a d. 10โ€“15 a
Answers: 2
question
Computers and Technology, 24.06.2019 04:30
Fall protection, confined space entry procedures, controlled noise levels, and protection from chemical hazards are some of the things that contribute to a safe what
Answers: 1
You know the right answer?
Python Instructions
The following instruction lists 5 steps to complete an inheritance appro...
Questions
question
Mathematics, 02.10.2019 22:10
Questions on the website: 13722367