Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that produces the following example output... (In Java) --- Report of Points and Circles --- Point(1.0, 1.0) is inside Circle(0.0, 0.0) Radius:

Write a program that produces the following example output... (In Java)

--- Report of Points and Circles --- Point(1.0, 1.0) is inside Circle(0.0, 0.0) Radius: 3.0 Point(2.0, 2.0) is inside Circle(0.0, 0.0) Radius: 3.0 Point(3.0, 3.0) is outside Circle(0.0, 0.0) Radius: 3.0 Point(4.0, 4.0) is outside Circle(0.0, 0.0) Radius: 3.0 Point(1.0, 1.0) is outside Circle(5.0, 5.0) Radius: 3.0 Point(2.0, 2.0) is outside Circle(5.0, 5.0) Radius: 3.0 Point(3.0, 3.0) is inside Circle(5.0, 5.0) Radius: 3.0 Point(4.0, 4.0) is inside Circle(5.0, 5.0) Radius: 3.0 --- Report of Points and Rectangles --- Point(1.0, 1.0) is inside Rectangle(-2.5, 2.5, 3.5, -2.5) Point(2.0, 2.0) is inside Rectangle(-2.5, 2.5, 3.5, -2.5) Point(3.0, 3.0) is outside Rectangle(-2.5, 2.5, 3.5, -2.5) Point(4.0, 4.0) is outside Rectangle(-2.5, 2.5, 3.5, -2.5) Point(1.0, 1.0) is outside Rectangle(-2.5, 5.0, 2.5, 2.5) Point(2.0, 2.0) is outside Rectangle(-2.5, 5.0, 2.5, 2.5) Point(3.0, 3.0) is outside Rectangle(-2.5, 5.0, 2.5, 2.5) Point(4.0, 4.0) is outside Rectangle(-2.5, 5.0, 2.5, 2.5) 

Your program must meet the following specifications:

Write a method static void reportPoint(double x, double y) that prints the details for a single point. For example it would print, without a newline: Point(1.0, 1.0)

Write a method static void reportCircle(double x, double y, double r) that prints the details for a single circle. For example it would print, without a newline: Circle(0.0, 0.0) Radius: 3.0

Write a method static void reportRectangle(double left, double top, double width, double height) that prints the details for a single rectangle.

The report of the rectangle should show the left, top, right, and bottom values, rather than the left, top, width, and height.

Write a method static boolean isPointInsideCircle(double ptX, double ptY, double circleX, double circleY, double circleRadius) that tests if a point is inside a circle.

Write a method static boolean isPointInsideRectangle(double ptX, double ptY, double rLeft, double rTop, double rWidth, double rHeight) that tests if a point is inside a rectangle.

In the main method use the following statements to initialize the point, circle, and rectangle data.

 double[] ptX = { 1, 2, 3, 4 }; double[] ptY = { 1, 2, 3, 4 }; double[] circleX = { 0, 5 }; double[] circleY = { 0, 5 }; double[] circleRadius = { 3, 3 }; double[] rectLeft = { -2.5, -2.5 }; double[] rectTop = { 2.5, 5.0 }; double[] rectWidth = { 6.0, 5.0 }; double[] rectHeight = { 5.0, 2.5 }; 

In the main method, loop over the circles, then the points, reporting on each as appropriate.

In the main method, loop over the rectangles, then the points, reporting on each as appropriate.

The first point is ptX[0] and ptY[0], the first circle is circleX[0], circleY[0], and circleRadius[0], and so on.

The right hand side of the rectangle is left + width, and the bottom of the rectangle is top - height. The following diagram illustrates the coordinate system for this assignment...

(left: 0, top: 8) +------+ | | | | | | | | | | +------+ (right: 8, bottom: 2) width: 8 height: 6

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago