Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write simple VB program for the following: 4.14 (Miles Per Gallon App) Drivers are concerned with the mileage obtained by their automobiles. One driver
Please write simple VB program for the following:
4.14 (Miles Per Gallon App) Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of several tankfuls of gasoline by recording the miles driven and the gallons used for each tankful. Each time the user enters the miles driven and gallons used (both as Double S) for a tankful and presses the Calculate MPG Button, the app should calculate the miles per gallon then display the miles driven, gallons used and miles per gallon in ListBoxes as shown in Fig. 4.24 9. The app should also display the total miles per gallon. (Be carefulthis is not the average of the miles per gallon for each tankful.) All average calculations should produce floating-point results. Avoid division by zeroif the user enters zero for the number of gallons, inform the user that the input value for gallons must be greater than zero. Miles Per Gallon o x milesDrivenLabel Enter miles driven: milesDriven TextBox gallonsUsedLabel Enter gallons used: gallonsUsedTextBox mpgLabel Calculate MPG calculateMPGButton gallonsLabel Miles: Gallons: MPG: milesLabel 300.00 13.50 22.22 450.00 milesListBox 17.00 mpgListBox 26.47 377.50 15.25 24.75 gallonsListBox Totals: Total miles driven: 1127.50 Total gallons used: 45.75 Total MPG: 24.64 totalsLabel totalResultsLabel Fig. 4.24 Miles Per Gallon GUIStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started