Computers and Technology

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.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 15:00, ryleerose255
Idon’t understand the double8 coding problem. it is java
Answers: 1
image
Computers and Technology, 23.06.2019 16:00, lokaranjan5736
Write a grading program for a class with the following grading policies: a. there are two quizzes, each graded on the basis of 10 points. b. there is one midterm exam and one final exam, each graded on the basis of 100 points. c. the final exam counts for 50% of the grade, the midterm counts for 25%, and the two quizzes together count for a total of 25%. (do not forget to normalize the quiz scores. they should be converted to a percentage before they are averaged in.) any grade of 90 or more is an a, any grade of 80 or more (but less than 90) is a b, any grade of 70 or more (but less than 80) is a c, any grade of 60 or more (but less than 70) is a d, and any grade below 60 is an f. the program will read in the student’s scores and output the student’s record, which consists of two quiz and two exam scores as well as the student’s average numeric score for the entire course and final letter grade. define and use a structure for the student reco
Answers: 2
image
Computers and Technology, 24.06.2019 03:00, SiegeHatake4534
Will do anything for brainlest so can you guys me out i will try my best to you out
Answers: 1
image
Computers and Technology, 24.06.2019 04:30, andrespacheco5888
Which of the following terms refers to a collection of different types of software that share the goal of infiltrating a computer and making it do something? a- malware b- virus c- spyware d- trojan horse
Answers: 2
Do you know the correct answer?
Python Instructions
The following instruction lists 5 steps to complete an inheritance appro...

Questions in other subjects: