Create a Python file called domino175.py. Inside this file, create and test a Domino class according to the description below. Note that the following methods form the public interface for this class - you must complete them all as specified, and cannot add additional methods to the public interface. However, you can include additional private helper methods that are only called within this class, if you wish. Domino (dotsA, dotsB) - creates a domino, where the number of dots on each end of the domino are described by the integers dotsA and dotsB. After asserting that the input parameters are valid, dotsA and dotsB should be used to initialize two private attributes: top and bottom. Both of these attributes are integers, and the top is the end with the most dots on it. A third private attribute, faceDown, should also be created which indicates if the tile is facing down (True) or facing up (False). A domino should be facing up when it is first created. setTop (dots) - updates which end of the Domino is at the top, according to the dots parameter. The integer dots must match one of the existing ends of the Domino instance (otherwise an AssertionError is raised). Nothing is returned. turnover () -updates the Domino instance so that if it was facing up, it will now be facing down. Similarly, if it was facing down, it will now be facing up. Nothing is returned. getTop () - returns the integer number of dots on the top end of the Domino instance. getBottom () - returns the integer number of dots on the bottom end of the Domino instance. isFaceDown () - returns the Boolean value indicating whether the Domino instance is facing down (True) or up (False). str () - returns the string representation of the Domino instance. The format of this string should be '[bottom number of dots|top number of dots]' if it is facing up. For example, a domino with 3 dots on the bottom and 4 dots on top will return the string '[314]'. Any domino that is facing down will have question marks, '?', instead of the numbers: ' [?|?]' Test your Domino class thoroughly before moving on. You may wish to use assertions to verify expected behaviour, like in Lab 7 (Linked Lists), though you don't have to. Place these tests under if main ": in domino175.py for the marker to see. 11 name \3D
Create a Python file called domino175.py. Inside this file, create and test a Domino class according to the description below. Note that the following methods form the public interface for this class - you must complete them all as specified, and cannot add additional methods to the public interface. However, you can include additional private helper methods that are only called within this class, if you wish. Domino (dotsA, dotsB) - creates a domino, where the number of dots on each end of the domino are described by the integers dotsA and dotsB. After asserting that the input parameters are valid, dotsA and dotsB should be used to initialize two private attributes: top and bottom. Both of these attributes are integers, and the top is the end with the most dots on it. A third private attribute, faceDown, should also be created which indicates if the tile is facing down (True) or facing up (False). A domino should be facing up when it is first created. setTop (dots) - updates which end of the Domino is at the top, according to the dots parameter. The integer dots must match one of the existing ends of the Domino instance (otherwise an AssertionError is raised). Nothing is returned. turnover () -updates the Domino instance so that if it was facing up, it will now be facing down. Similarly, if it was facing down, it will now be facing up. Nothing is returned. getTop () - returns the integer number of dots on the top end of the Domino instance. getBottom () - returns the integer number of dots on the bottom end of the Domino instance. isFaceDown () - returns the Boolean value indicating whether the Domino instance is facing down (True) or up (False). str () - returns the string representation of the Domino instance. The format of this string should be '[bottom number of dots|top number of dots]' if it is facing up. For example, a domino with 3 dots on the bottom and 4 dots on top will return the string '[314]'. Any domino that is facing down will have question marks, '?', instead of the numbers: ' [?|?]' Test your Domino class thoroughly before moving on. You may wish to use assertions to verify expected behaviour, like in Lab 7 (Linked Lists), though you don't have to. Place these tests under if main ": in domino175.py for the marker to see. 11 name \3D
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...
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
Recommended textbooks for you
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
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
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY