
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
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](https://content.bartleby.com/qna-images/question/fc6971b1-d827-469c-97ec-2870aa5abf00/03a6d4de-f6d4-4f30-9c87-3cd12e8382f2/qzbz3e_thumbnail.jpeg)
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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images

Knowledge Booster
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
- Create a Point class to hold x and y values for a point. Create methods show(), add() and subtract() to display the Point x and y values, and add and subtract point coordinates. Create another class Shape, which will form the basis of a set of shapes. The Shape class will contain default functions to calculate area and circumference of the shape, and provide the coordinates (Points) of a rectangle that encloses the shape (a bounding box). These will be overloaded by the derived classes; therefore, the default methods for Shape will only print a simple message to standard output. Create a display() function for Shape, which will display the name of the class and all stored information about the class (including area, circumference and bounding box). Build the hierarchy by creating the Shape classes Circle, Rectangle and Triangle. Search the Internet for the rules governing these shapes, if necessary. For these three Shape classes, create default constructors, as well as constructors…arrow_forwardjava please dont take other website'answer. rthis is actually practice question ANIMALCLASS Create an Animal class. Each animal has a name, an x and y integer coordinate. The Animal class should have at minimum the following methodsbelowbut you may want to add more if necessary: Also note, everyanimal will need to have to have “z”passed to it so that it knows how big the map is. •A constructor that starts the animal at 0,0 with a name of "Unknown Animal"and only accepts a single int value (int mapSize). •A parameter constructor that allows the programmerto input all 4pieces of information.(x,y, name, mapSize)oCheck the parameters for valid input based on the constraints. Ifany of the input valuesis invalid, adjust it any way you deem necessary in order to make it valid. •getX()and getY() •getName() •toString(). o This should print out the name and coordinates of the animal. •touching(Animal x) This method should determine if the animal is on the same spot as a secondanimal(x). It…arrow_forwardHelp, I making a elevator simulator, I need help in writing code in the Elevator class and it's polymorphism class. I am not sure what to do next. Any help is appreciated. There are 4 types of passengers in the system:Standard: This is the most common type of passenger and has a request percentage of 70%. Standard passengers have no special requirements.VIP: This type of passenger has a request percentage of 10%. VIP passengers are given priority and are more likely to be picked up by express elevators.Freight: This type of passenger has a request percentage of 15%. Freight passengers have large items that need to be transported and are more likely to be picked up by freight elevators.Glass: This type of passenger has a request percentage of 5%. Glass passengers have fragile items that need to be transported and are more likely to be picked up by glass elevators. There are 4 types of elevators in the system:StandardElevator: This is the most common type of elevator and has a request…arrow_forward
- Add a toString method to your Account class. For the purposes of this assignment, please use the toString display the following: This account contains $x. You have earned $y in the last month. where x is the account balance (please don't format the decimals) and y is the monthly interest earned, obtained from the getMonthlyInterest method. Compile and test in a driver by creating and printing an Account object. Add an equals method to your Account class. Two Account objects are equal if their balance and annualInterestRates are equal. Compile and test in your driver by creating 2 Account objects to see if they are equal.arrow_forwardClass Circle A Circle will have a radius. The class will be able to keep track of the number of Circle objects created. It will also hold the total of the circumferences of all the Circle objects created. It will allow a client to create a Circle, passing in a double value for the radius into the Circle constructor. If the value for the radius that is passed in is 0 or negative, then the radius will be set to a value of 999. The constructor should add 1 to the count of the number of Circles created. The constructor should call a method to calculate the circumference and then add the circumference for that object to an accumulator. In addition to the constructor, the Circle class must have the following methods that return a boolean value: isCongruent(Circle c) – Compares two Circle objects to determine if they are congruent (radii are equal). isValid() – the radius may not be 0 or negative. equals (Triangle t) – compares two Triangle objects…arrow_forwardIn python and include doctring: First, write a class named Movie that has four data members: title, genre, director, and year. It should have: an init method that takes as arguments the title, genre, director, and year (in that order) and assigns them to the data members. The year is an integer and the others are strings. get methods for each of the data members (get_title, get_genre, get_director, and get_year). Next write a class named StreamingService that has two data members: name and catalog. the catalog is a dictionary of Movies, with the titles as the keys and the Movie objects as the corresponding values (you can assume there aren't any Movies with the same title). The StreamingService class should have: an init method that takes the name as an argument, and assigns it to the name data member. The catalog data member should be initialized to an empty dictionary. get methods for each of the data members (get_name and get_catalog). a method named add_movie that takes a Movie…arrow_forward
- #Testing Please test my code and see if it meet the follwing needs: The class should implement the Comparable interface. Circle one is less than Circle two if the radius of Circle one is less than the radius of Circle two. The two Circles are equal if they have the same radius. Circle one is larger than Circle two if its radius is larger. If circle One.compareTo circle Two <> 0 The Test Class displays a menu that allows the user to: Enter a Circle (the user only needs to enter the radius). Print all Circles (print the toString for each Circle in the ArrayList). Quit To adda a circle Cases: The ArrayList is empty The new circle is less than the first circle, add it at the beginning. The circle is greater than the last circle, add it at the end The new circle belongs somewhere in the middle. import java.lang.Math;public class Circle implements Comparable<Circle> {private double radius;public Circle(double radius) {this.radius = radius;}public double findArea()…arrow_forwardDevelop a set of classes for a college to use in various student service andpersonnel applications. Classes you need to design include the following:• Person—A Person contains a first name, last name, street address, zip code,and phone number. The class also includes a method that sets each datafield, using a series of dialog boxes and a display method that displays all of aPerson’s information on a single line at the command line on the screenarrow_forwardHere are what to display on your Pokémon's show page: The pokemon's name The image of the pokemon An unordered list of the Pokemon's types (eg. water, poison, etc). The pokemon's stats for HP, ATTACK, and DEFENSE. module.exports = [ { id: "001", name: "Bulbasaur", img: "http://img.pokemondb.net/artwork/bulbasaur.jpg", type: [ "Grass", "Poison" ], stats: { hp: "45", attack: "49", defense: "49", spattack: "65", spdefense: "65", speed: "45" }, ]; Routes Your app should use RESTful routes: Index GET /pokemon Show GET /pokemon/:id New GET /pokemon/new Edit GET /pokemon/:id/edit Create POST /pokemon Update PUT /pokemon/:id Destroy DELETE /pokemon/:idarrow_forward
- when coding a chess game, implement the following method: isInCheck(Side s): Returns true if the king of side s is attacked by any of the opponent’s pieces, i.e., if in the current board state, any of the opponents pieces can move to where the king is. Otherwise, it returns false. Note that this method is only used to warn the player when they are in check. You can use the GUI to test if this is working. public boolean isInCheck(Side side) { // TODO write this method return false; } public enum Side { BLACK, WHITE; public static Side negate(Side s) { return s == Side.BLACK ? Side.WHITE : Side.BLACK; } }arrow_forwardThis is for pygame Ball Class: The Ball class inherits from Drawable and it will draw a circle at its current location. You must implement at the very least the required methods of the base class (draw and get_rect), as well as a constructor. You may need to implement other methods as part of the public interface. This is the Drawable Classarrow_forwardModify the Lab 6 java applet that produces a Bulls Eye with six concentric circles usingtwo colors as shown below. The applet should include a method that creates anddisplays a filled circle. The for loop should be modified to use the method. (See pg. 376,Programming Project 11, Savitch).The fillCircle method can be placed above or below the paint method and should bedefined using the following:private void fillCircle (Graphics canvas, int X, int Y, int diameter, Color color){canvas.setColor(color);canvas.fillOval(X, Y, diameter, diameter);}The program should continue to use Named Constants to establish and maintain the xand y settings for the circles and the amount to change the diameter for each circle.Use a for loop to control the drawing of each of the 6 circles. Within the loop, increasethe x, y settings; reduce the diameter for the new circle; and alternate the colors whencalling the drawCircle method. Test your code using the AppletViewer.Sample using AppletViewarrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education