Question: JAVA PLEASE The TriangleSolver Program Write a Java program that prompts the user for the cartesian coordinates of the vertices of a triangle. The program

JAVA PLEASE JAVA PLEASE The TriangleSolver Program Write a Java program that prompts theuser for the cartesian coordinates of the vertices of a triangle. The

The TriangleSolver Program Write a Java program that prompts the user for the cartesian coordinates of the vertices of a triangle. The program displays the vertices. It then computes and displays the length of the sides, the perimeter, area, and centroid of the triangle to the nearest thousandths. Your program is not required to check whether the points are noncollinear. Typical sample runs of the program should appear as shown below: Listing 1: Sample Run Enter the x-coordinate and y-coordinate of the first vertex 1.54.75 Enter the x-coordinate and y-coordinate of the second vertex 3.24.65 Enter the x-coordinate and y-coordinate of the third vertex 1.785.87 Triangle: p1=(1.500,4.750);p2=(3.200,4.650);p3=(1.780,5.870) Side A=1.702939; side B=1.154; side C=1.872 Perimeter =4.730 Area =0.966 Centroid =(2.160,5.090) Listing 2: Sample Run Enter the x-coordinate and y-coordinate of the first vertex 3.141591.25 Enter the x-coordinate and y-coordinate of the second vertex 3.212.75 Enter the x-coordinate and y-coordinate of the third vertex 1.456.9857 Triangle: p1=(3.142,1.250);p2=(3.200,12.750);p3=(1.450,6.986) Side A=15.369312; side B=8.408; side C=7.406 Perimeter =31.183 Area =14.273 Centroid =(0.464,6.162) Listing 3: Sample Run Enter the x-coordinate and y-coordinate of the first vertex 00 Enter the x-coordinate and y-coordinate of the second vertex 030 Enter the x-coordinate and y-coordinate of the third vertex 400 Triangle: p1=(0.000,0.000);p2=(0.000,30.000);p3=(40.000,0.000) Side A=30.000000; side B=40.000; side C=50.000 Enter the x-coordinate and y-coordinate of the first vertex 3.141591.25 x-coordinate and y-coordinate of the second vertex 3.212.75 x-coordinate and y-coordinate of the third vertex 1.456.9857 Triangle: p1=(3.142,1.250);p2=(3.200,12.750);p3=(1.450,6.986) Side A=15.369312; side B=8.408; side C=7.406 Perimeter =31.183 Area =14.273 Centroid =(0.464,6.162) Listing 3: Sample Run Enter the x-coordinate and y-coordinate of the first vertex 0 Enter the x-coordinate and y-coordinate of the second vertex 30 Enter the x-coordinate and y-coordinate of the third vertex 400 Triangle: p1=(0.000,0.000);p2=(0.000,30.000);p3=(40.000,0.000) Side A=30.000000; side B=40.000; side C=50.000 Perimeter =120.000 Area =600.000 Centroid =(13.333,10.000) Listing 4: Sample Run Enter the x-coordinate and y-coordinate of the first vertex 55 Enter the x-coordinate and y-coordinate of the second vertex 0 Enter the x-coordinate and y-coordinate of the third vertex 55 Triangle: p1=(5.000,5.000);p2=(0.000,0.000);p3=(5.000,5.000) Side A=7.071068; side B=14.142; side C=7.071 Perimeter =28.284 Area =0.000 Centroid =(0.000,0.000)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!