Write a program that prompts the user for a measurement in meters and then converts it to miles, feet, and inches. Again, check for valid input and exit with an error msg if you don’t get it. Testing: use some known values here and watch for integer truncation.
This should be in javascript and should execute in netbeans.
<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">Try</button>
<p id="demo"></p>
<script>
function myFunction() {
meters = parseFloat(prompt("Enter meters"));
miles = meters * 0.000621;
feets = meters * 3.28084;
inches = meters * 39.3701;
alert("Meters: "+meters+"\nMiles: "+miles+"\nFeets:
"+feets+"\nInches: "+inches);
}
</script>
</body>
</html>
Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me
Get Answers For Free
Most questions answered within 1 hours.