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 09:40
Sarah is having a hard time finding a template for her advertising business that she may be able to use at a later date and also make it available to her colleagues
Answers: 1
question
Computers and Technology, 23.06.2019 03:30
In vista and windows 7, the appearance and personalization option allows you to change the
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
Facial expressions and gestures are examples of messages.
Answers: 3
question
Computers and Technology, 23.06.2019 17:00
Companies that implement and apply an information system effectively can create
Answers: 1
You know the right answer?
Python Instructions
The following instruction lists 5 steps to complete an inheritance appro...
Questions
question
Mathematics, 04.12.2020 19:20
question
Mathematics, 04.12.2020 19:20
Questions on the website: 13722367