STARTING OUT W/JAVA PLUS ACCESS >IP<
STARTING OUT W/JAVA PLUS ACCESS >IP<
19th Edition
ISBN: 9780135396094
Author: MUGANDA
Publisher: PEARSON EDUCATION (COLLEGE)
bartleby

Concept explainers

bartleby

Videos

Question
Book Icon
Chapter 14, Problem 2AW
Program Plan Intro

Circle class:

  • The “Circle” class is used to draws a circle by its center point located at a particular coordinate, and with a specified radius.
  • This class consists of five types of constructor.
    • “Circle()”:
      • This constructor creates an empty circle.
      • User can specify the center point for circle using the “setCenterX” and “setCenterY” methods.
      • Using “setRadius” method user can create the circle radius.
      • Using “setFill” method user can fill a color for the circle.
    • “Circle(radius)”:
      • This constructor takes “double” argument.
      • It is used to create a circle of specified radius.
      • User can specify the center point for circle using the “setCenterX” and “setCenterY” methods.
      • Using “setFill” method user can fill a color for the circle.
    • “Circle(centerX, centerY, radius)”:
      • This constructor takes three arguments as “doubles”.
      • This constructor creates a circle using a center point and a particular radius.
      • In this constructor, the circle is filled with the black color by default.
      • Using “setFill” method user can fill a different color for the circle.
    • “Circle(centerX, centerY, radius, fill)”:
      • This constructor is used to create a circle using a center point, radius and fill with a color.
      • In this constructor, the three arguments “centerX”, “centerY” and “radius” takes the value as a “double”.
      • The “fill” argument is an object of “Paint” class.
    • “Circle(radius, fill)”:
      • This constructor is used to create a circle using a radius and fill with a color.
      • In this constructor, “radius” argument is a “double” and the “fill” argument is an object of “Paint” class.

Example:

The example for creating “Circle” class is shown below:

Circle exampleCircle = new Circle(85, 120, 60);

Here,

  • The “exampleCircle” is the object of “Circle” class.
  • The above code creates a circle with its center point at the “(85, 120)” and a radius of “60”.

Blurred answer
Students have asked these similar questions
Q2: Wire a code for an Arduino Car Speed Detector shown in the schematic diagram below (IR sensor=KY-032) IR sensor 1 IR sensor 2 How it works: This project works on a simple physics law of calculating the speed as distance/time. Speed = Distance/Time When a car passes the ist IR sensor, it detects and save the first-time value. Then we measure the second time value when the car reaches the IR sensor 2. The difference of both the time is the travel distance from one sensor to the other. We get the time in which car travels a distance of 10 meters so we can calculate the speed of the car. 10 meters
: A point in the x-y plane is represented by its x-coordinate and y-coordinate. Design a class, pointType, that can store and process a point in the x-y plane. You should then perform operations on the point, such as showing the point, setting the coordinates of the point, printing the coordinates of the point, returning the x-coordinate, and returning the y-coordinate. Also, write a test program to test the various operations on the point.
Q#2: Create a class named “Rectangle” having length and width as attribute. There should be behaviors to set the values of length and width (individually and collectively), and get their values individually. There should also behavior to display the perimeters and area of the rectangle. Create another class named as Main which have two objects of Rectangle (r1, r2) having length (3.2, 20) and width (4.5, 36) respectively. Also display the length, width, perimeter and area of both rectangles.

Chapter 14 Solutions

STARTING OUT W/JAVA PLUS ACCESS >IP<

Ch. 14.1 - Prob. 14.11CPCh. 14.1 - Which of the following is not a subclass of the...Ch. 14.2 - Prob. 14.13CPCh. 14.2 - Prob. 14.14CPCh. 14.2 - Prob. 14.15CPCh. 14.2 - Prob. 14.16CPCh. 14.2 - Prob. 14.17CPCh. 14.2 - Prob. 14.18CPCh. 14.2 - Prob. 14.19CPCh. 14.2 - Prob. 14.20CPCh. 14.2 - Prob. 14.21CPCh. 14.3 - Prob. 14.22CPCh. 14.3 - Prob. 14.23CPCh. 14.3 - Prob. 14.24CPCh. 14.3 - Prob. 14.25CPCh. 14.3 - Prob. 14.26CPCh. 14.3 - Prob. 14.27CPCh. 14.3 - Prob. 14.28CPCh. 14.3 - Prob. 14.29CPCh. 14.3 - Prob. 14.30CPCh. 14.4 - What two classes do you use to play an audio file?Ch. 14.4 - Refer to your answer to Checkpoint 14.31. In what...Ch. 14.4 - Prob. 14.33CPCh. 14.4 - Prob. 14.34CPCh. 14.5 - What three classes do you use to play a video...Ch. 14.5 - Refer to your answer to Checkpoint 14.35. In what...Ch. 14.5 - Prob. 14.37CPCh. 14.6 - Prob. 14.38CPCh. 14.6 - Prob. 14.39CPCh. 14.6 - What type of event happens when the user presses...Ch. 14.6 - What KeyEvent method can you call to determine...Ch. 14.6 - Refer to your answer for Checkpoint 14.41. What...Ch. 14 - Line, Circle, and Rectangle are subclasses of...Ch. 14 - Prob. 2MCCh. 14 - Prob. 3MCCh. 14 - Prob. 4MCCh. 14 - Prob. 5MCCh. 14 - Prob. 6MCCh. 14 - Prob. 7MCCh. 14 - Prob. 8MCCh. 14 - This interpolator causes an animation to start...Ch. 14 - You use these two classes to play an audio file....Ch. 14 - Prob. 11TFCh. 14 - Prob. 12TFCh. 14 - True or False: If an ellipses X-radius and...Ch. 14 - Prob. 14TFCh. 14 - Prob. 15TFCh. 14 - Write a statement that instantiates the Line...Ch. 14 - Prob. 2AWCh. 14 - Prob. 3AWCh. 14 - Write code that does the following: Instantiates...Ch. 14 - Prob. 5AWCh. 14 - Prob. 6AWCh. 14 - Prob. 7AWCh. 14 - Prob. 8AWCh. 14 - Prob. 9AWCh. 14 - Prob. 10AWCh. 14 - Prob. 11AWCh. 14 - Prob. 1SACh. 14 - Prob. 2SACh. 14 - Prob. 3SACh. 14 - Prob. 4SACh. 14 - Prob. 5SACh. 14 - Prob. 6SACh. 14 - What RotateTransition class method do you use to...Ch. 14 - Prob. 8SACh. 14 - Prob. 9SACh. 14 - Prob. 10SACh. 14 - Prob. 11SACh. 14 - This Old House Use the basic shapes you learned in...Ch. 14 - Tree Age Counting the growth rings of a tree is a...Ch. 14 - Hollywood Star Make your own star on the Hollywood...Ch. 14 - Prob. 4PCCh. 14 - Solar System Use the Circle class to draw each of...Ch. 14 - Prob. 6PCCh. 14 - Prob. 7PCCh. 14 - Prob. 8PCCh. 14 - Coin Toss Write a program that simulates the...Ch. 14 - Lunar Lander The books online resources...Ch. 14 - Change for a Dollar Game The books online...Ch. 14 - Rock, Paper, Scissors Game Write a program that...
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Time Complexity Analysis - How To Calculate Running Time | InterviewBit; Author: InterviewBit;https://www.youtube.com/watch?v=--oxG4Q1PA0;License: Standard YouTube License, CC-BY