Question: Programming Activity Write a program that prompts the user to enter two points (x1,y1) and (x2,y2), calculates and displays the distance between them. The formula
Programming Activity Write a program that prompts the user to enter two points (x1,y1) and (x2,y2), calculates and displays the distance between them. The formula for computing the distance is distance=(x2x1)2+(y2y1)2 Check the sample output below. Notice that you can use Math.pow (a,b) to calculate ab and you can use Math.sqrt(a) to calculate a. You can name your program Distance.java When done, raise your hand to let the TA know that you are ready to demonstrate your code for grading. II import statement(s), class header, and main method header I. If declare variables for the inputs and outputs 11 instantiate a scanner object If prompt for Inpues 1) calculate distance If dieplay the output (1 docimal place, using peinte) Sample Output Enter x1:1.5 Enter y1:3,4 Enter 2:4.5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
