Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 image text in transcribedimage text in transcribed

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

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

Genomes Browsers And Databases Data Mining Tools For Integrated Genomic Databases

Authors: Peter Schattner

1st Edition

0521711320, 978-0521711326

More Books

Students also viewed these Databases questions

Question

8. Demonstrate aspects of assessing group performance

Answered: 1 week ago