Big Java, Binder Ready Version: Early Objects
Big Java, Binder Ready Version: Early Objects
6th Edition
ISBN: 9781119056447
Author: Cay S. Horstmann
Publisher: WILEY
bartleby

Videos

Question
Book Icon
Chapter 2.10, Problem 46SC
Program Plan Intro

Syntax to draw a line:

To draw a line, use the object of “Line2D.Double” and this class fixes the co-ordinates for the circle based on the “x” and “y” co-ordinates of the endpoints.

Consider the following code to construct a line,

//Draw a line using the object “lin1”

Line2D.Double lin1=new Line2D.Double(x1, y1, x2, y2);

Explanation:

  • In the above code, the “Line2D.Double” represents that there are two class names “Line2D” and “Double” which is separated by period (.) symbol and it passes four co-ordinates namely “x1”, “y1”, “x2”, and “y2”.
  • Next, using the graphics object “g2”, call draw()method to draw the line using the corresponding object used for line segment.

Another method is to create the object for each endpoint and use the “Point2D” class to represent the line; the following is the syntax,

//Draw a line using the object in point class

Point2D.Double from_pt=new Point2D.Double(x1, y1);

Point2D.Double to_pt=new Point2D.Double(x2, y2);

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
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.
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
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY