Question: Java program 1 a) Write a program that reads a distance in kilometres as a double value from the console, then converts it to miles
Java program
1 a)
Write a program that reads a distance in kilometres as a double value from the console, then converts it to miles and displays the result, to 3 decimal places. Assume that 1 km = 0.625 miles.
Note: the Scanner class provides convenient ways of doing input from the console
b) Write a program that prompts the user to enter an elapsed time in seconds as an integer, then computes and displays the equivalent numbers of hours, minutes and seconds.
For example, if the user inputs 7520, the program should print
2 hours, 5 minutes, 20 seconds
Hint: you will need to use the / and % operators here.
c) Write a program that prompts the user to enter the coordinates of two points (x1,y1)(x1,y1) and (x2,y2)(x2,y2), using the double type for all values. Your program should then display the Euclidean distance between these two points.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
