Big Java, Binder Ready Version: Early Objects
Big Java, Binder Ready Version: Early Objects
6th Edition
ISBN: 9781119056447
Author: Cay S. Horstmann
Publisher: WILEY
Question
Book Icon
Chapter 2.10, Problem 45SC
Program Plan Intro

Syntax to draw an ellipse:

To draw an ellipse, either any one of the classes need to be used such as “Ellipse2D.Float” and “Ellipse2D.Double” and this class is used based on the ellipse co-ordinates of single or double precision floating values.

Consider the following code to construct an ellipse,

//Fix the co-ordinates and assign it to object “ellip1”

Ellipse2D.Double ellip1=new Ellipse2D.Double(x, y, width, height);

In the above code, the “Ellipse2D.Double” represents that there are two class names “Ellipse2D” and “Double” which is separated by period (.) symbol and it passes four co-ordinates namely “x”, “y”, “width”, and “height”.

Syntax to draw a circle:

To draw a circle, follow the same code but for width and height use the same values. Here, the circle is passed with “x-coordinate”, “y-coordinate”, and “diameter”.

//Fix the co-ordinates and assign it to object “cir1”

Ellipse2D.Double cir1=new Ellipse2D.Double(x, y, diameter, diameter);

//Call draw() to draw the circle

g2.draw(cir1);

Explanation:

  • In the above code, “cir1” is the object name of the circle and it passes four parameters such as “x-coordinate”, “y-coordinate”, and “diameter”.
  • Next, using the graphics object “g2”, call draw()method to draw the circle.

Blurred answer

Chapter 2 Solutions

Big Java, Binder Ready Version: Early Objects

Ch. 2.2 - Prob. 11SCCh. 2.2 - Prob. 12SCCh. 2.2 - Prob. 13SCCh. 2.3 - Prob. 14SCCh. 2.3 - Prob. 15SCCh. 2.3 - Prob. 16SCCh. 2.3 - Prob. 17SCCh. 2.3 - Prob. 18SCCh. 2.3 - Prob. 19SCCh. 2.3 - Prob. 20SCCh. 2.4 - How do you construct a square with center (100,...Ch. 2.4 - Prob. 22SCCh. 2.4 - Prob. 23SCCh. 2.4 - Prob. 24SCCh. 2.4 - Prob. 25SCCh. 2.5 - Prob. 26SCCh. 2.5 - Prob. 27SCCh. 2.5 - Prob. 28SCCh. 2.5 - Prob. 29SCCh. 2.5 - Prob. 30SCCh. 2.6 - Prob. 31SCCh. 2.6 - Prob. 32SCCh. 2.6 - Prob. 33SCCh. 2.6 - Prob. 34SCCh. 2.6 - Prob. 35SCCh. 2.7 - Prob. 36SCCh. 2.7 - Prob. 37SCCh. 2.8 - Prob. 38SCCh. 2.8 - Prob. 39SCCh. 2.9 - Prob. 40SCCh. 2.9 - Prob. 41SCCh. 2.9 - Prob. 42SCCh. 2.9 - Prob. 43SCCh. 2.9 - Prob. 44SCCh. 2.10 - Prob. 45SCCh. 2.10 - Prob. 46SCCh. 2.10 - Prob. 47SCCh. 2.10 - Prob. 48SCCh. 2.10 - Prob. 49SCCh. 2 - Prob. 1RECh. 2 - Prob. 2RECh. 2 - Prob. 3RECh. 2 - Prob. 4RECh. 2 - What is the value of mystery after this sequence...Ch. 2 - What is wrong with the following sequence of...Ch. 2 - Prob. 7RECh. 2 - Give an example of a method that has an argument...Ch. 2 - Write Java statements that initialize a string...Ch. 2 - Write Java statements that initialize a string...Ch. 2 - Write Java statements that initialize a string...Ch. 2 - Explain the difference between an object and an...Ch. 2 - Give the Java code for constructing an object of...Ch. 2 - Prob. 14RECh. 2 - Prob. 15RECh. 2 - Prob. 16RECh. 2 - Prob. 17RECh. 2 - Prob. 18RECh. 2 - Name two accessor methods and two mutator methods...Ch. 2 - Prob. 20RECh. 2 - Explain the difference between an object and an...Ch. 2 - Prob. 22RECh. 2 - Prob. 23RECh. 2 - Prob. 24RECh. 2 - Prob. 25RECh. 2 - Prob. 26RECh. 2 - Prob. 27RECh. 2 - Write an AreaTester program that constructs a...Ch. 2 - Write a PerimeterTester program that constructs a...Ch. 2 - Write a program that initializes a string with...Ch. 2 - Write a program that constructs a rectangle with...Ch. 2 - Prob. 5PECh. 2 - Prob. 6PECh. 2 - Prob. 7PECh. 2 - Prob. 8PECh. 2 - Prob. 9PECh. 2 - Prob. 10PECh. 2 - Prob. 11PECh. 2 - The Random class implements a random number...Ch. 2 - Prob. 13PECh. 2 - Look at the API of the Point class and find out...Ch. 2 - Using the Day class of Worked Example 2.1, write a...Ch. 2 - Prob. 16PECh. 2 - Prob. 17PECh. 2 - Prob. 18PECh. 2 - Prob. 19PECh. 2 - Prob. 20PECh. 2 - Prob. 1PPCh. 2 - Prob. 2PPCh. 2 - Prob. 3PPCh. 2 - Prob. 4PPCh. 2 - Prob. 5PPCh. 2 - Prob. 6PPCh. 2 - Prob. 7PPCh. 2 - Prob. 8PPCh. 2 - Prob. 9PPCh. 2 - Prob. 10PPCh. 2 - Prob. 11PPCh. 2 - Prob. 12PPCh. 2 - Prob. 13PPCh. 2 - Prob. 14PPCh. 2 - Prob. 15PP
Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education