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
Starting Out with C++ from Control Structures to Objects (8th Edition)
C++ How to Program (10th Edition)
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Problem Solving with C++ (10th Edition)
Artificial Intelligence: A Modern Approach
- use Pyhton. The tossball simulation we developed together in class is attached to this week's notes. Study it carefully to understand exactly what it is doing. It currently launches a ball in the main graphics window. You need to make the following changes and improvements and send me at the end your finished project in zipped folder format. Only python modules should be included. 1) Add a new class named "Cannon". This class it to represent the cannon that launches the balls. It should draw a rectangle (hint: use Polygon class from Graphics.py) at the launch point. Its width should be equal to the diameter of the balls that it shoots out and its length should be proportional to the speed, say something like speed * 0.15. The cannon should also be directed in the same direction that the balls shooting. Add proper width, height, and angle attributes to the class for supporting the settings above. The balls should start from the bottom of the cannon and be projected out through the…arrow_forwardFor this step, you will only need to modify, and thus focus on, the following class: • ReadShapeFile.java You will also need to look at only the constructors of the following classes: Figure 1: Empty Window with a Title: Shape Booooi- iinggg Frame • Circle.java • Oval.java Pretend the rest of the code does not exist. This is how we break large programs into smaller components that a human can understand and work with. It’s also how the rest of engineering works as well. Think about how the parts of a car engine are compartmentalised nicely into components. You don’t need to hold the entire functionality of the engine in your head at one time – just the component you are working on and how it interfaces with the rest of the system. It is very important that you only modify code in the files you are asked to modify. If your development environment suggests to change code outside these files don’t do it – even if it makes things magically compile and the red text disappears. Please assume…arrow_forwardDraw as similar as with the help of java also attached code screenshotarrow_forward
- The first image is the main question and the second image is the directions for the program. The program has to be written in Java and please use the directions given in the second image to write the program.arrow_forwardUsing any existing 2D or 3D graphics library ( Java 2D, Java 3D, draw a scene to show : Given in the picture The following guidelines MUST BE USED: Show evidence of at least four colors. Have a textual composition on the finished product. Imagery or images Scene composition of at least six (6) elements One of the following 1) Shadows or Glows. May be of cartoon type or more polished composition. Duplication of at least one element coming from an existing class.arrow_forwardCreate a VisualCounter class that supports both increment and decrement operations. Take the constructor inputs N and max, where N indicates the maximum number of operations and max specifies the maximum absolute value for the counter. Create a plot that shows the value of the counter each time its tally changes as a side effect.arrow_forward
- It should be written in java language and be fully commented Write a graphics program that draws your name in red, centered inside a blue rectangle.arrow_forwardIf an artist would like a drawing to be freely available everyone, make it: a. Public domain b. Shareware c. Vector graphic d. Freeware A 1-bit depth image is mostly represented as a. Black and white b. Yellow and red c. Black and yellow d. Red, blue, greenarrow_forwardimport java.awt.*;public class TestRandomWalker {public static final int STEPS = 500;public static void main(String[] args) {RandomWalker walker = new RandomWalker(); // instantiate Walker objectDrawingPanel panel = new DrawingPanel(500, 500);Graphics g = panel.getGraphics();// advanced features -- center and zoom in the imagepanel.getGraphics().translate(250, 250);panel.getGraphics().scale(4, 4);// make the walker walk, and draw its movementint prevX = walker.getX(); // initialize Walker displayint prevY = walker.getY();for (int i = 1; i <= STEPS; i++) {g.setColor(Color.BLACK);g.drawLine(prevX, prevY, walker.getX(), walker.getY()); // update Walker display walker.move(); // move Walker 1 stepprevX = walker.getX(); // update x valueprevY = walker.getY(); // update y valueg.setColor(Color.RED); g.drawLine(prevX, prevY, walker.getX(), walker.getY()); // update Walker display int steps = walker.getSteps(); // record Walker stepsif (steps % 10 == 0) {System.out.println(steps + "…arrow_forward
- 1. Design the following class hierarchy. a. A GeometricObject represents a general geometric figure. It has properties:i. isFilledii. color iii. thickness. b. Rectangle and Circle are geometric objects. Add suitable data and methods.c. Drawing is a collection of geometric objects. Number of geometric objects can be 5. User should be able to calculate total area of Drawing and count the shapes which are filled. Note:Solve in Javaarrow_forwardConstruct a class called Hypixel that will contain all information needed to describe and manipulate a pixel. Then construct a class called xy screen that will represent a computer screen.arrow_forward(It must be done on python) Create a “Rectangle” class, which is a geometric figure. The rectangle must have two attributes: “side1” and “side2” and methods that calculate area and perimeter must be implemented.Also define a class “Square”, which is an equal-sided rectangle.arrow_forward
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTSystems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning