Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help 1. Design a VB project to compute and display some statistics about

ID: 3623725 • Letter: P

Question

Please help


1. Design a VB project to compute and display some statistics about a road trip the user has taken
during a long weekend. The user should enter the following information:
• Distance in miles,
• The gallons of gas used,
• Price per gallon,
• The number of minutes it took to drive to destination.
When the user clicks on “Compute” Button, the program should compute and display the following
information in one large Label, on three separate lines:
• The mileage (miles per gallon),
• The average speed on this trip (miles per hour),
• Cost of gas.
The program should have Buttons to clear the input and output boxes and to end the program
execution.

Explanation / Answer

Label5.Text = ""

Dim dis As Decimal

Dim gallons As Decimal

Dim price As Decimal

Dim time As Decimal

dis = CDec(TextBox1.Text)

gallons = CDec(TextBox2.Text)

price = CDec(TextBox1.Text)

time = CDec(TextBox1.Text)

Label5.Text = "Mile Per Gallons:" & (dis / gallons) & "Average Speed:" & (dis / time) & "Cost of Gas :" & (price * gallons)

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click

        'Clear the input and results

Textbox1.Clear()

Textbox2.Clear()

Textbox3.Clear()

Textbox4.Clear()

    End Sub