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 14 Solutions
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Additional Engineering Textbook Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
C How to Program (8th Edition)
Database Concepts (8th Edition)
Computer Science: An Overview (12th Edition)
Problem Solving with C++ (9th Edition)
- 9 public class PictureViewer 10{ public static void main(String[] args) 11 12 // Step 2: Fix the syntax errors and submit it to Codecheck to pass the test. // Note: Do not add or remove any statements 13 // 14 15 // Do not change the semantics of each statement Do not add or remove any variables Do not add or remove any objects Magic numbers are allowed 16 17 18 // 19 // 20 // Create an object of Picture by loading an image Picture pic = Picture("starry_night.png"); 21 22 23 // Display the width and height System.out.println("Width : " + pic.getWidth()); System.out.println("Height: 24 25 + pic.getHeight()); %3D 26 27 // Increase the width by 50 on both sides and // increase the height by 40 on both sides. // Must use dw and dh when calling method grow(). int dw, dh = 40; pic.grow(dw, dh); 28 29 30 31 32 33 // Display the width and height System.out.println("Width : System.out.println("Height: 34 + pic.getWidth()); + pic.getHeight()); 35 36 37 // Draw the picture draw(); 38 39 40 //…arrow_forwardThe number of observations in a particular class is called: a. Class boundary b. Frequency c. Width of the class d. Class markarrow_forwardإرشادات Define the object Circle in a class, considering that the circle has a center coordinates x and y and a radius r. The class can find the area (PI^2 * r) and a perimeter (2*PI*r)arrow_forward
- Java Programming Create a program that will compute for the area and perimeter of a rectangle using classes.arrow_forwardComplete the missing line of code: public class Rectangle { private int width; private int height; public Rectangle( this.width = width3B %3D this.height = height; %3Darrow_forwardThe NET Framework has a class called that includes a number of methods for conducting sophisticated mathematical calculations.arrow_forward
- JAVA PROGRAMDefine the classes (see attached photo)arrow_forwardOthello 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_forwardWrite the following program in C++. ÒMake a Class Named point that represents a point with x and y coordinates on a 2D plane ÒMake class Named line that represents a line on a 2D Plane and it has a start point and an end point ÒMake a triangle class that is composed of three lines ÒMake a rectangle class that is composed of four linesarrow_forward
- Java 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_forwardIn JAVA plsarrow_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