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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 03:30, juliannxkim
Which group on the home tab allows you to add shapes to a powerpoint slide?
Answers: 1
image
Computers and Technology, 22.06.2019 06:40, EricaLSH7624
Match the personality traits with their description
Answers: 2
image
Computers and Technology, 22.06.2019 12:50, michaelchavez6959127
You have just been hired as an information security engineer for a large, multi-international corporation. unfortunately, your company has suffered multiple security breaches that have threatened customers' trust in the fact that their confidential data and financial assets are private and secured. credit-card information was compromised by an attack that infiltrated the network through a vulnerable wireless connection within the organization. the other breach was an inside job where personal data was stolen because of weak access-control policies within the organization that allowed an unauthorized individual access to valuable data. your job is to develop a risk-management policy that addresses the two security breaches and how to mitigate these risks. requirementswrite a brief description of the case study. it requires two to three pages, based upon the apa style of writing. use transition words; a thesis statement; an introduction, body, and conclusion; and a reference page with at least two references. use a double-spaced, arial font, size 12.
Answers: 1
image
Computers and Technology, 23.06.2019 08:30, mai1261
Helen's credit card has an apr of 15.32% and a grace period of 17 days and helen pays her balance in the full every month. if her last billing cycle ended on september 26, 2009, and she made her payment on october 11, 2009, did she owe any interest on her last statement's balance?
Answers: 3
You know the right answer?
Python Instructions
The following instruction lists 5 steps to complete an inheritance appro...

Questions in other subjects:

Konu
Mathematics, 07.05.2020 13:57
Konu
Mathematics, 07.05.2020 13:57