Line, Circle, and Rectangle are subclasses of rhe class.
- a. Sprite
- b. Geometry
- c. BasicShape
- d. Shape
The “Line”, “Circle” and “Rectangle” are subclasses of the “Shape”.
Hence, the correct answer is option “D”.
Explanation of Solution
Shape class:
- The basic functionality for drawing shapes is included in “Shape” class.
- A specific shape is been drawn by each of the subclasses in “Shape” class.
- The “Shape” class is present in JavaFX library.
- The lines are been drawn using “Line” class.
- The circles are been drawn using “Circle” class.
- The “Shape” class as well as its subclasses is present in “javafx.scene.shape” package.
Example:
The example for a “Line” class constructor is given below:
Line(startX, startY, endX, endY)
Here, “startX” and “startY” denotes starting point’s “X” and “Y” coordinates. The “endX” and “endY” denotes ending point’s “X” and “Y” coordinates.
Explanation for incorrect options:
a. Sprite:
The “Sprite” class does not involve the subclasses for “Line”, “Circle” and “Rectangle”.
Hence, the option “A” is wrong.
b. Geometry:
The “Geometry” class does not involve the subclasses for “Line”, “Circle” and “Rectangle”.
Hence, the option “B” is wrong.
c. BasicShape:
The “BasicShape” class does not involve the subclasses for “Line”, “Circle” and “Rectangle”.
Hence, the option “C” is wrong.
Want to see more full solutions like this?
Chapter 13 Solutions
Starting Out with Java: Early Objects (6th Edition)
Additional Engineering Textbook Solutions
Elementary Surveying: An Introduction To Geomatics (15th Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Starting Out With Visual Basic (8th Edition)
Database Concepts (8th Edition)
Degarmo's Materials And Processes In Manufacturing
- javaarrow_forwardWhat graphics class would be best for drawing a square?a) Square b) Polygon c) Line d) Rectanglearrow_forwardShape -width: double -length: double +allmutatorMethods Shapes2D Shapes3D -height:double *calSize():double +calVolume():double 1. Define class Shape, 2DShape and 3DShape as per UML class diagram given. 2. Define all mutator methods(set and get) for all classes. 3. Define methods calArea() with formula area - width * length for 2DShapes. 4. Define methods calArea() with formula calvolume, volume = width*length*height for 3DShapes. In the main program, declare and set data in 1 object of 3DShapes. Create an array OR ArrayList of 2DShapes, set and display the info of all objects as shown in the output. 5.arrow_forward
- Java Programming Create a program that will compute for the area and perimeter of a rectangle using classes.arrow_forwardThink an object with many properties and methods except for gadgets. Example: Person Properties - Age, height Methods - Walk, Talkarrow_forwardPlease do it in JavaScript or C# 1) Design and implement the class structure for a drawing application. A drawing is made up of a canvas that contains a collection of three different shapes: circles, lines, and boxes. Each shape can be drawn by calling a Draw() method for that shape. The canvas class should also have a draw method that draws all of the shapes it contains. You don’t have to actually draw anything on a screen; you can simulate drawing by writing a message to the console.For example, the code snippet: canvas.Draw();Drawing a circle at...Drawing a line at...etc. (For each shape on the canvas) 2)(Bonus) Consider re-writing the above answer (#1) differently where the canvas does not contain the shapes, but is able to draw any of the three shapes passed to it. Re-design canvas.Draw() if you need to. Your main() program should ask for user input on what shape to draw. Ask once, draw, then exit.could produce something like the following output to the console:arrow_forward
- Java Object Oriented Programingarrow_forward1. Create the Java Class for the class diagram shown below.arrow_forwardComputer Science I need the code for this in Alice programming Faery Magic Create a world that has at least 5 different objects from the Furniture Gallery and one Faery from the Fantasy/Faeries Gallery. The Faery has the power to make an object disappear. Everything that the faery touches disappear from the scene. Create an interactive game where the user can click one object at a time from the scene; then, the faery faces that object and moves toward it. Write a recursive method named CheckDistance, that checks whether the faery is very close to the object clicked by the user. If it is, the faery bends over to touch the object. After the faery touches the object, the object disappears (this is the base case of the recursion). If the faery is not yet close enough to the object to be able to touch it, the faery moves a small distance forward and the CheckDistance method is recursively called (this is the recursive case of the recursion). Include instructions for the game that appears…arrow_forward
- Othello is played with white and black pieces. When surrounded by opponents on all sides or top and bottom, a piece is caught and its colour is flipped. You must capture one opponent piece on your turn. When neither player can move, the game finishes. Most pieces wins. Othello object-oriented design.arrow_forwardJava program for a game or rock paper sciscors agaist a computer where the winner is not decided until the best 3 out of 5 gamesarrow_forwardJava - Encapsulation A rectangle can be formed given two points, the top left point and the bottom right point. Assuming that the top left corner of the console is point (0, 0), the bottom right corner of the console is point (MAX, MAX) and given two points (all “x” and “y” coordinates are positive), you should be able to draw the rectangle in the correct location, determine if it is a square or a rectangle, and compute for its area, perimeter and center point. To be able to do this, you should create a class Point (that has an x-coordinate and a y-coordinate). Also, create another class called Rectangle. The Rectangle should have 2 points, the top left and the bottom right. You should also implement the following methods for the Rectangle: display() - draws the rectangle on the console based on the samplearea() - computes and returns the area of a given rectangleperimeter() - computes and returns the perimeter of a given rectanglecenterPoint() - computes and returns the center point…arrow_forward
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage