Question

In: Computer Science

Create an application that calculates mph or (Miles Per Hour). There should be 2 textboxes for...

Create an application that calculates mph or (Miles Per Hour). There should be 2 textboxes for input, and 2 labels to label the input textboxes. The first textbox should be the miles driven. And the other textbox should be hours taken.

There should be a button to calculate miles per hour. And a label or textbox for the results of the calculate.

1textbox for miles [input]

2textbox for hours (time used) [input]

3label for miles textbox

4label for hours textbox

button for calculate mph [to start program]

label or textbox to get results [output]

NEED CS FILE PLS

Solutions

Expert Solution

<html>
<head>
</head>
<body align="center">
<form method="post"><br><br>
 <label>Enter no.of miles:</label>
 <input id="miles" type="text" name="miles" required><br><br>
 <label>Enter no.of hours:</label>
 <input id="hours" type="text" name="hours" required><br><br>
 <button onclick="calculate()" type="button" name="button">Submit</button>
</form>
<p id="res"></p>
<script>
 function calculate() {
   var miles = document.getElementById('miles');
   var hrs = document.getElementById('hours');
   console.log(miles.value);
   if(miles.value=="" && hrs.value==""){
     document.getElementById('res').innerHTML = "Enter no of miles and no of hours";
     miles.focus();
   }
   else if (miles.value=="") {
     document.getElementById('res').innerHTML = "Enter no of miles";
     miles.focus();
   }
   else if (hrs.value=="") {
     document.getElementById('res').innerHTML = "Enter no of hours";
     hrs.focus();
   }
   else {
     document.getElementById('res').innerHTML = (miles.value/hrs.value)+" mile/hour";
   }

 }
</script>
</body>
</html>

Related Solutions

Your car gets 22 miles per gallon (MPG) at 55 miles per hour (MPH) and 18...
Your car gets 22 miles per gallon (MPG) at 55 miles per hour (MPH) and 18 MPG at 65 MPH. At what speed should you make a 450-mile trip 1. If gas costs $2.95 per gallon and your time is worth $17/hour? 2. If gas costs $3.80 per gallon and your time is worth $11.5/hour? 3. If gas costs $4.75 per gallon and your time is worth $8.9/hour? 4. Building an Excel spreadsheet to calculate the total trip cost for...
Your car gets 25 miles per gallon (mpg) at 60 miles per hour (mph) and 18...
Your car gets 25 miles per gallon (mpg) at 60 miles per hour (mph) and 18 mpg at 70 mph. At what speed should you make a 600-mile trip: 1. If gas costs $3 per gallon and your time is worth $12 per hour? 2. If gas costs $4 per gallon and your time is worth $15 per hour? 3. If gas costs $5 per gallon and your time is worth $10 per hour? 4. Build a spreadsheet to calculate...
Your car gets 29 miles per gallon (mpg) at 60 miles per hour (mph) and 25...
Your car gets 29 miles per gallon (mpg) at 60 miles per hour (mph) and 25 mpg a 70 mph. At what speed should you make a 525-mile trip: If gas costs $3 per gallon and your time is worth $18 per hour If gas costs $4 per gallon and your time is worth $12 per hour If gas costs $5 per gallon and your time is worth $9 per hour
In 1974, the United States instituted a national speed limit of 55 miles per hour (mph),...
In 1974, the United States instituted a national speed limit of 55 miles per hour (mph), a move that generated a great deal of controversy. Proponents of the lower speed limit managed to avoid repeal of this national speed limit by effectively arguing that driving at 55 mph significantly reduced the number of traffic fatalities on U.S. highways. The argument was based on the fact that the total number of traffic fatalities dropped from 55,511 in 1973 to only 46,402...
When traveling 40 mph (miles per hour), the distance that it takes Fred’s car to stop...
When traveling 40 mph (miles per hour), the distance that it takes Fred’s car to stop varies evenly between 120 and 155 feet. (This includes the reaction distance and the braking distance.) All of the questions are related to the stopping distance when Fred is traveling 40 mph. a) Let S be the distance it takes for Fred’s car to stop at when traveling 40 mph. Find the distribution, parameter(s), and support of S. b) What is the probability that...
Consider a 2850-lb automobile clocked by law-enforcement radar at a speed of 85.5 mph (miles/hour). If...
Consider a 2850-lb automobile clocked by law-enforcement radar at a speed of 85.5 mph (miles/hour). If the position of the car is known to within 5.0 feet at the time of the measurement, what is the uncertainty in the velocity of the car?
For a car that travels 70 mph for 60 miles and then 80 mph for 60...
For a car that travels 70 mph for 60 miles and then 80 mph for 60 miles. The total time traveled is given by calculating the distance per rate traveled for each part and then summing the values. •Have the program in c++ that calculates the most appropriate mean rate of the two different rates and the two equal distances, and output the result to the text file. The “best” mean rate is the rate at which T=D/R is same...
Create an application that calculates and displays the amount of a homeowner’s property tax. The tax...
Create an application that calculates and displays the amount of a homeowner’s property tax. The tax is 1.35% of the property’s assessed value, which will be entered by the user. a. Prepare a Planning Chart for the application. b. Draw a sketch of an appropriate interface. Be sure to follow the GUI design guidelines covered in the chapter. The guidelines are summarized in Figure 2-20. (If you want to include an image in the interface, you can either use your...
In C# Create a GUI application that calculates and displays the total travel expenses of a...
In C# Create a GUI application that calculates and displays the total travel expenses of a business person on a trip. Here is the information that the user must provide: Number of days on the trip Amount of airfare, if any Amount of car rental fees, if any Number of miles driven, if a private vehicle was used Amount of parking fees, if any Amount of taxi charges, if any Conference or seminar registration fees, if any Lodging charges, per...
Create an Investment application that calculates how many years it will take for a $2,500 investment...
Create an Investment application that calculates how many years it will take for a $2,500 investment to be worth at least $5,000 if compounded annually at 7.5% ( Java Programming)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT