Please use javascript for this code. One lap around a standard high-school running track is exactly 0.25 miles. Write a program that takes a number of miles as input, and outputs the number of laps. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: System.out.printf("%.2f", yourValue); Ex: If the input is: 1.5 the output is: 6.00 import java.util.Scanner; public class LabProgram { /* Define your method here */ public static void main(String[] args) { /* Type your code here. Your code must call the method. */ } }
Please use javascript for this code.
One lap around a standard high-school running track is exactly 0.25 miles. Write a
Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
System.out.printf("%.2f", yourValue);
Ex: If the input is: 1.5 the output is: 6.00
import java.util.Scanner;
public class LabProgram {
/* Define your method here */
public static void main(String[] args) {
/* Type your code here. Your code must call the method. */
}
}
Program:
<!DOCTYPE html>
<html>
<body>
<h2>Conversion</h2>
<p>Convert the miles into laps </p>
<p id="demo"></p>
<script>
var x;
var y ;
var x=prompt("Enter the value in miles");
y=x/0.25;
document.write("Laps is ="+y.toFixed(2));
</script>
</body>
</html>
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images