Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a NetBeans project named CPS150_Lab13 . Copy-and-paste the highlighted code below into the main method of your new CPS150_Lab13 class. Complete the following code

Create a NetBeans project named CPS150_Lab13.

Copy-and-paste the highlighted code below into the main method of your new CPS150_Lab13 class.

Complete the following code to test whether two circles, each having a user-defined radius and a fixed center point lying along the same horizontal line, are disjoint, overlapping, or mutually contained.

image text in transcribed

public class CPS150_Lab13 { public static void main(String[] args) { Scanner in = new Scanner(System.in); // red circle variables int red_radius = 0; int red_centerX = 0; // no red_centerY since circles are aligned on the x-axis int red_left_point = 0; // point on x-axis intersected by left edge int red_right_point = 0; // point on x-axis intersected by right edge // blue circle variables int blue_radius = 0; int blue_centerX = 0; // no blue_centerY since circles are aligned on the x-axis int blue_left_point = 0; // point on x-axis intersected by left edge int blue_right_point = 0; // point on x-axis intersected by right edge /* * get the radius and center point x-coordinate * for the red circle */ System.out.print("Input the radius of the red circle: "); red_radius = in.nextInt(); System.out.print("Input the x-coordinate of the red circle's center point: "); red_centerX = in.nextInt(); /* * get the radius and center point x-coordinate * for the blue circle */ System.out.print("Input the radius of the blue circle: "); blue_radius = in.nextInt(); System.out.print("Input the x-coordinate of the blue circle's center point: "); blue_centerX = in.nextInt(); /* * for each circle, calculate the points where the left * and right edges intersect the x-axis * * *** ADD CODE HERE *** */ /* * determine and output the relationship between * the red and blue circles as one of: * i. circles are disjoint * ii. red circle is contained in blue circle * iii. blue circle is contained in red circle * iv. circles are overlapping * * *** ADD CODE HERE *** */ } // end main method } // end class CPS150_Lab13

Sample Runs (user input in red):

Input the radius of the red circle: 10 Input the x-coordinate of the red circle's center point: 0 Input the radius of the blue circle: 15 Input the x-coordinate of the blue circle's center point: 40 circles are disjoint Input the radius of the red circle: 15 Input the x-coordinate of the red circle's center point: 50 Input the radius of the blue circle: 20 Input the x-coordinate of the blue circle's center point: 0 circles are disjoint Input the radius of the red circle: 10 Input the x-coordinate of the red circle's center point: 20 Input the radius of the blue circle: 40 Input the x-coordinate of the blue circle's center point: 30 red circle is contained in blue circle Input the radius of the red circle: 10 Input the x-coordinate of the red circle's center point: 20 Input the radius of the blue circle: 20 Input the x-coordinate of the blue circle's center point: 30 red circle is contained in blue circle Input the radius of the red circle: 40 Input the x-coordinate of the red circle's center point: 20 Input the radius of the blue circle: 10 Input the x-coordinate of the blue circle's center point: 30 blue circle is contained in red circle Input the radius of the red circle: 20 Input the x-coordinate of the red circle's center point: 20 Input the radius of the blue circle: 10 Input the x-coordinate of the blue circle's center point: 30 blue circle is contained in red circle Input the radius of the red circle: 10 Input the x-coordinate of the red circle's center point: 0 Input the radius of the blue circle: 15 Input the x-coordinate of the blue circle's center point: 10 circles are overlapping Input the radius of the red circle: 10 Input the x-coordinate of the red circle's center point: 10 Input the radius of the blue circle: 15 Input the x-coordinate of the blue circle's center point: 0 circles are overlapping

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

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions

Question

l Explain several rater errors by giving examples of them.

Answered: 1 week ago

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago