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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
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_name
_main_": in domino175.py for the marker to see.
Task 2: DominoDeck class
Create and test a DominoDeck class in domino175.py, 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
Transcribed Image Text: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_name _main_": in domino175.py for the marker to see. Task 2: DominoDeck class Create and test a DominoDeck class in domino175.py, 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
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Math class and its different methods
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education