Patti Garcia owns two cars, referred to as Car 1 and Car 2. She wants to drive
Question:
Patti Garcia owns two cars, referred to as Car 1 and Car 2. She wants to drive one of the cars to her vacation destination, but she’s not sure which one (if any) would cost her the least amount in gas. Use the following names for the solution and project, respectively: Car Solution and Car Project. Save the application in the VB2015\Chap04 folder.
a. The application’s interface should provide text boxes for Patti to enter the following five items: the total miles she will drive, Car 1’s miles per gallon, Car 2’s miles per gallon, Car 1’s cost per gallon of gas, and Car 2’s cost per gallon of gas. (The cost per gallon of gas must be entered separately for each car because one car uses regular gas and the other uses premium gas.) The interface should display the total cost of the gas if she takes Car 1 as well as the total cost of the gas if she takes Car 2. It should also display a message that indicates which car she should take and approximately how much she will save by taking that car (show the savings with no decimal places). Display the message in either a label or a message box. If the total cost of gas would be the same for both cars, Patti should take Car 1 because that’s her favorite car.
b. The three text boxes that get the trip miles and the miles per gallon should accept only numbers and the Backspace key. The two text boxes that get the cost per gallon should accept only numbers, the period, and the Backspace key.
c. When a text box receives the focus, its existing text should be selected.
d. The calculated amounts and message (if you are using a label) should be cleared when a change is made to the contents of a text box in the interface.
e. Test the application using 1200, 28, 35, 3.69, and 3.38 as the trip miles, Car 1’s miles per gallon, Car 2’s miles per gallon, Car 1’s cost per gallon, and Car 2’s cost per gallon, respectively.
f. Now, change Car 1’s miles per gallon to 35. Also change Car 2’s miles per gallon to 28. Which car should Patti take, and how much (approximately) will she save?
g. Next, change Car 1’s miles per gallon and cost per gallon to 28 and 3.38, respectively. Which car should Patti take, and how much (approximately) will she save?
Step by Step Answer: