Question: 11. Open the VB2015Chap03Mileage SolutionMileage Solution (Mileage Solution.sln) file. The application displays the miles per gallon, given the miles driven and gallons used. In the

11. Open the VB2015\Chap03\Mileage Solution\Mileage Solution (Mileage Solution.sln)

file. The application displays the miles per gallon, given the miles driven and gallons used. In the General Declarations section of the Code Editor window, enter your name, the current date, and the three Option statements. Use variables and the TryParse method to code the btnCalc_Click procedure. Use the Format function to display the miles per gallon with two decimal places. Save the solution and then start the application. Enter 324 and 17 as the miles driven and gallons used, respectively. The miles per gallon should be 19.06. Clear the screen. Now test the application using invalid data. More specifically, test it without entering any data, and then test it using letters as the input. When invalid data is entered, the Miles per gallon box will say either NaN (which stands for Not a Number) or Infinity. Both messages are a result of the miles per gallon calculation attempting to divide a Double number by the number 0.

In Chapter 4, you will learn how to prevent these error mesages by using a selection structure.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming with Microsoft Visual Basic 2015 Questions!