Question: intoduction to Java, help me? Lab 08: Console Input and Output Lab Exercise 2 - Calculate Distance between Two Points Problem Description: Write a Java

intoduction to Java, help me? intoduction to Java, help me? Lab 08: Console Input and Output Lab

Lab 08: Console Input and Output Lab Exercise 2 - Calculate Distance between Two Points Problem Description: Write a Java program (Calculate Distance.java) that asks the user to input two points with coordinates (x1, yl) and (x2, y2) and displays the distance between them. Use the following formula to compute the distance: distance = /(x2 - x1)2 + (y2 - y1)2 Tips: you may use Math.pow (a, b) to compute a (a raised to the power of b) and Math.sqrt(a) to compute Va. Use the System.out.printf () method to output all float-point numbers with only two decimal places as shown below in the sample output Sample output: & Gau Enter the value of xl: 1.54 Enter the value of yl: -3.4 Enter the value of x2:44 Enter the value of y2:54 xl and yl are (1.50, -3,40) x2 and y2 are (1.50, -3.40) The distance between the two points is 8.76

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!