Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en>">
- <head>
- <meta charset="utf-8">
- <title>5F act 3</title>
- </head>
- <body>
- <script>
- alert("Hello! This program will calculate how long it will take you to arrive at your destination.");
- var distance, speed, time1, time2;
- distance = prompt("enter how far you will travel in km/h");
- distance = parseFloat(distance)
- speed = prompt("enter the average spped at which you will travel in km/h");
- speed = parseFloat(speed)
- time1 = distance / speed;
- time2 = time1.toFixed(2)
- alert("trip distance: "+ distance +" km \naverage speed: "+speed +" km/h \nestimated time to arrival: "+ time2 +" hour(s)");
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment