[Solved] Exericise1401extra Write Program Prompts User Enter Center Coordinates Radius Two Circles Q37262229
Exericise14_01Extra
Write a program that prompts the user to enter the centercoordinates and radius of two circles. The program displays thecircles and a text indicating whether the two are overlapping,whether one is contained in the other, or whether they don’toverlap, as shown below .
here is my code. I need everything in one file.
package methods;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.shape.Circle;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.geometry.Insets;
import javafx.stage.Stage;
public class Exercise_14_01Extra extends Application{
Circle circleOne, circleTwo;
public static void main(String[] args)
{
launch(args);
}
@Override
public void start(Stage stage)
{
Pane pane = new Pane();
VBox vBox = new VBox(50);
vBox.setPadding(new Insets(70,55,55,70));
createCircle();
String output = (“”);
if(checkInside(circleOne,circleTwo) ||checkInside(circleTwo,circleOne))
output +=(“One circle is contained in another”);
else if (checkOverlaping(circleOne,circleTwo))
output +=(“The circles overlap”);
else
output +=(“Circles do not overlap”);
pane.getChildren().addAll(circleOne, circleTwo);
vBox.getChildren().addAll(pane,new Text(20,0, output));
Scene scene = new Scene(vBox);
stage.setTitle(“Check overlaping”);
stage.setScene(scene);
stage.show();
}
private void createCircle()
{
circleOne = newCircle(Double.parseDouble(getParameters().getNamed().get(“Circle1x”)));
getNamed().get(“Circle1y”);
circleOne.setFill(Color.YELLOW);
circleOne.setStroke(Color.RED);
circleTwo = newCircle(Double.parseDouble(getParameters().getNamed().get(“Circle2x”)));
getNamed().get(“Circle12y”);
circleOne.setFill(Color.PINK);
circleOne.setStroke(Color.BLACK);
}
public boolean checkInside(Circle c1, Circle c2 )
{
return c2.getY() <= c1.getY() && c2.getX() <=c2.getX() && c2.getX() > c1.getX() && c2.getY()> c1.getY();
}
public boolean checkOverlaping(Circle c1, Circle c2)
{
double getX();
double getY();
return getDistance(c1.getX(), c2.getX()&&getDistance(c1.getY(),c2.getY()));
}
private double getDistance(double p1, double p2)
{
return Math.sqrt(Math.pow(p2- p1,2));
}
}
LExercise14-01 Exercise14 01 One circle is contained in another The circles overlap 매 Exercise!401 The circles do not overlap Show transcribed image text LExercise14-01 Exercise14 01 One circle is contained in another The circles overlap 매 Exercise!401 The circles do not overlap
Expert Answer
Answer to Exericise14_01Extra Write a program that prompts the user to enter the center coordinates and radius of two circles. The… . . .
OR

