Object Orientation Question 5a 1. Provide code to define a class Sport to represent individual sports objects. Sport should include name, equipment, number of players, number of umpires and a rules list (empty at first) 2. Create a method add_rule (Rule) to add a rule item to the extendable list of rules. 3. Create a method get_equipment () for getting the required equipment as a list of strings 4. Create a method_str__ to output the information about the sport as a string 5. Add docstrings to each of your methods to explain the usage/purpose/arguments 6. Test and demonstrate your class and methods by: • creating three sports objects • adding at least two rules to each sport • getting and printing the equipment for each sport • printing the string version of each sport object e.g. • "Netball"; Court+goals+ball+bibs; 7 per team (two teams); 2; Rules: "3 seconds to pass", "no bouncing" • "Tennis"; court+net+racquets+balls; 2; 1 umpire + 2+ lines people; Rules: "max bounce of 1", "serve into box"

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

have a nice day

Question 5
Object Orientation
Question 5a
1. Provide code to define a class Sport to represent individual sports objects. Sport should include name, equipment, number of players, number of umpires and a rules list (empty at first)
2. Create a method add_rule (Rule) to add a rule item to the extendable list of rules.
3. Create a method get_equipment () for getting the required equipment as a list of strings
4. Create a method ___str__ to output the information about the sport as a string
5. Add docstrings to each of your methods to explain the usage/purpose/arguments
6. Test and demonstrate your class and methods by:
• creating three sports objects
• adding at least two rules to each sport
• getting and printing the equipment for each sport
• printing the string version of each sport object
e.g.
• "Netball"; Court+goals+ball+bibs; 7 per team (two teams); 2; Rules: "3 seconds to pass", "no bouncing"
• "Tennis"; court+net+racquets+balls; 2; 1 umpire + 2+ lines people; Rules: "max bounce of 1", "serve into box"
Transcribed Image Text:Question 5 Object Orientation Question 5a 1. Provide code to define a class Sport to represent individual sports objects. Sport should include name, equipment, number of players, number of umpires and a rules list (empty at first) 2. Create a method add_rule (Rule) to add a rule item to the extendable list of rules. 3. Create a method get_equipment () for getting the required equipment as a list of strings 4. Create a method ___str__ to output the information about the sport as a string 5. Add docstrings to each of your methods to explain the usage/purpose/arguments 6. Test and demonstrate your class and methods by: • creating three sports objects • adding at least two rules to each sport • getting and printing the equipment for each sport • printing the string version of each sport object e.g. • "Netball"; Court+goals+ball+bibs; 7 per team (two teams); 2; Rules: "3 seconds to pass", "no bouncing" • "Tennis"; court+net+racquets+balls; 2; 1 umpire + 2+ lines people; Rules: "max bounce of 1", "serve into box"
Expert Solution
steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY