create an application in VISUAL BASIC that calculates a cars gas mileage. The formula for calculating the miles that a car can travel per gallon of gas is MPG = Miles/Gallon
In the formula MPG is miles-per-gallon, miles is the number of miles that can be driven on a full tank of gas, and gallons is the number of gallons that the tank holds.
The applications form should have TextBox controls that let the
user enter the number of gallons of gas the tank holds and the
number of miles the car can be driven on a full tank. When the
Calculate MPG button is clicked, the application should display the
number of miles that the car can be driven per gallon of gas. The
form should also have a clear button that clears the input and
results, and an EXIT button that ends the application. If the user
fails to enter numeric values, display appropriate error message
and do not attempt to perform calculations. THe applications form
should appear as show below![Miles per Gallon Calculator in the Designer Forml.vb [Design] ㄨ Miles per Gallon Calculator Gallons of gas the car can hold Number of miles it can be driven on a full tank Miles per gallon: Cakulate Use the following set of test data to determine if the application is calculating propdi Gallons Miles Miles per Gallon 10 12 15 375 289 190 37.50 24.08 12.67](http://img.homeworklib.com/questions/8a520ed0-2f51-11eb-b90c-0b62a48c0fce.png?x-oss-process=image/resize,w_560)
Ans:-
"program to generate the miles per gallon calculator.
Public Class formMilesPerGallon
"To compute the mpg value by getting the values from the text boxes
Private Sub btnCalculateMPG_click(sender As Object,e As EventArgs) Handles CalculateMPG.click
"declaration of required variables
Dim numGallons As Double = 0
Dim numMiles As Double = 0
Dim MPG As Double = 0
"To convert the textbox values to doubles
numGallons=Double.Parse(txtNumGallons.Text)
numMiles=Double.Parse(txtNumMiles.Text)
MPG=numMiles/numGallons "Formula to calculate mpg
lblMPG.Text=MPG.ToString("n2") "set mpg value to txtmpg by setting the decimal place to 2
End Sub
"To clear the content of input text boxes.
Private Sub btnClear_Click(sender As Object,e As EventArgs) Handles btnClear.Click
txtNumGallons.Clear()
txtNumMiles.Clear()
lblMPG.Text=""
End Sub
"To exit from the application if we press the exit buton
Private Sub btnExit_Click(sender As Object,e As EventArgs) Handles btnExit.Click
Me.close()
End Sub
End Class
sample output:-
enter the data in the fields of text boxes as shown below

Now press the calculate MPG button and the result will be shown as 37.50 at the immediate text box.
And if we press the clear button all data in the text boxes will get erased.
Finally to exit press Exit button.
create an application in VISUAL BASIC that calculates a cars gas mileage. The formula for calculating...
I need trying to figure out how I can make create a code in
Python with this exercise for I am having trouble doing so.
Miles Per Gallon Calculator Write a GUI program that calculates a car's gas mileage. The program's window should have Entry widgets that let the user enter the number of gallons of gas the car holds, and the number of miles it can be driven on a full tank. When a Calculate MPG button is clicked,...
Hi,
Hi,
I need someone to write a program in Phython 3.6, and please I
will appreciate if the code is error free and indented correctly.
The output would be preferable.
thanks
Write a GUI program that translates the Latin words to English. The window should have three buttons, one for each Latin word. When the user clicks a button, the program displays the English translation in a label. 3. Miles Per Gallon Calculator Write a GUI program that calculates...
7. Miles-per-Gallon 6pts A car’s miles-per-gallon (MPG) can be calculated with the following formula: MPG = Miles driven / Gallons of gas used Design a program that asks the user for the number of miles driven and the gallons of gas used. It should calculate the car’s miles-per-gallon and display the result on the screen.Draw a flowchart in algorithmic language
IN C++ Programming Problem 1: Write a program that calculates a truck's gas mileage and cost for a road trip. Be creative with the output, think of it as a “report”, give it a title at the top and use formatting where appropriate. The program should set the number of gallons of gas that the truck can hold to 31, and the number of miles it can be driving on a full tank to 651. The program should display the...
Drivers are concerned with the mileage their automobiles get. One driver has kept track of several tankfuls of gasoline by recording the miles driven and gallons used for each tankful. Develop a C# app that will input the miles driven and gallons used (both as integers) for each tankful. The app should calculate and display the miles per gallon obtained for each tankful and display the combined miles per gallon obtained for all tankfuls up to this point. All averaging...
Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of several tankfuls of gasoline by recording miles driven and gallons used for each tankful. Develop a C++ program that will input the miles driven and gallons used for each tankful. The program should calculate and display the miles per gallon obtained for each tankful. After processing all input information, the program should calculate and print the combined miles per gallon obtained for all tankfuls....
Classwork 2-2: Input & Formatting A car's miles-per-gallon (MPG) can be calculated using the formula: MPG - miles driven/gallons of gas used Write a program that asks the user for the car's make, number of miles driven and the gallons of gas used. It should calculate the car's MPG and displays the result rounded to 2 decimal places. Example "Your Honda's MPG is 28.56" On Blackboard, submit a screenshot of successfully running and testing your code on HackerRank.com: www.hackerrank.com/csc124-chapter-2-classwork (2nd...
In this exercise, you’ll upgrade a version of the MPG
application so the error messages are displayed in span elements to
the right of the text boxes.
Open the HTML and JavaScript files in this folder:
exercises_short\ch06\mpg\
Then, run the application and click the Calculate MPG button to
see that an error message is displayed in an alert dialog box for
each of the two input fields.
2. In the HTML file, add a span element after the input element...
NAME: RECORD ANSWER WITH CORRECT UNITS AND CORRECT SIG FIGS IN BOX PROVIDED-USE SCIENTIFIC NOTATION IF OVENIENT. SHOW UNIT CONVERSION PROCESS IN SPACE PROVIDED BELOW EACH QUESTION FOR FULL CREDIT. 1. Assume your hybrid car gets 38.0 miles per gallon (mpg) and the current price per gallon of regular, unleaded gasoline is $2.52. The car's gas tank holds 11.5 gallons. a. How far (in km) can the car travel on a tank of gas? b. What will be the cost...
***JAVASCRIPT***
I need JAVASCRIPT codes for this question. Also a little
explanation and full screenshots of the codes.
Short 6-1 Upgrade the MPG application In this exercise, you'll upgrade a version of the MPG application so the error messages are displayed in span elements to the right of the text boxes. Estimated time: 10 to 15 minutes. Calculate Miles Per Gallon Miles Driven Mies must be numeric and greater than zero Gallons of Gas Used Gallons must be numeric and...