Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Patti Garcia owns two cars, referred to as Car 1 and Car 2 . She wants to drive one of the cars to her vacation

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. Create a Windows Forms application. Use the following names for the project and solution, respectively: Car Project and Car Solution. Save the application in the VB9e\Chap04 folder. Change the form file's name to Main Form.vb. Change the form's name to frmMain. (F4.1F4.4, A4.6)
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 (mpg), Car 2's miles per gallon (mpg), 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 and the total cost of the gas if she takes Car 2; display both amounts with a dollar sign and two decimal places. It should also display the car she should take (either Car 1 or Car 2) and approximately how much she will save by taking that car (show the savings with a dollar sign and no decimal places). If the total cost of gas would be the same for both cars, Patti should take Car 1 because that is 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 output 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,1.97, and 2.09 as the trip miles, Car 1's mpg, Car 2's mpg, Car 1's cost per gallon, and Car 2's cost per gallon, respectively. (Hint: The total costs for Car 1 and Car 2 are $84.43 and $71.66, respectively. By taking Car 2, Patti will save approximately $13.)
f. Now, change Car 1's mpg to 35. Also, change Car 2's mpg to 28. Which car should Patti take, and how much (approximately) will she save?
g. Next, change Car 1's mpg and cost per gallon to 28 and 2.09, respectively. Which car should Patti take, and how much (approximately) will she save?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

3. Contrast relational contexts in organizations

Answered: 1 week ago

Question

2. Describe ways in which organizational culture is communicated

Answered: 1 week ago

Question

1. Describe and compare approaches to managing an organization

Answered: 1 week ago