Write a program that helps a person decide on whether to buy a hybrid car.

thumbYour program's inputs should be

- The cost of a new car
- The estimated miles driven per year
- The estimated price of a gallon of gas
- The efficiency of the new car in miles per gallon
- The estimated resale value after 5 years

Your program's output should be

- the total cost of fuel for 5 years
- the total cost of owning the car for 5 years (fuel + depreciation in car value)

You can then run your program with the cost, gas mileage, and resale value for a normal car and a hybrid car and determine which is less expensive.

Before you can write code, you will need to decide on how to solve this problem by hand. Write pseudo code that shows what you would do by hand. Then convert this pseudo-code into a program.

If you get stuck:

- Write small parts of your program and then test them. For example, knowing the miles per gallon and the gas price, you can estimate the cost of gas over 5 years. Make sure this part of your program is correct before you include resale value.
- Talk to your friends about problems you may have, and describe your approach to them. Your ideas often become clearer as you explain them to someone else.
- You can ask the TA to listen your ideas, but don't let them solve the problem for you.

Compute the total cost of owning the car for 5 years. (For simplicity, we will not take the cost of financing into account.) Obtain realistic prices for a new and used hybrid and a comparable car from the Web. Run your program twice, using today's gas price and 15,000 miles per year.

When you have your program working, you will need to show it to a TA. The TA will evaluate your code based on the following criteria and his/her own input values:

- Did you print any answer without crashing? (7 points)
- Did you calculate the fuel costs correctly? (7 points)
- Did you calculate the total costs correctly? (6 points)

Extra credit: Assume that

- a new normal car costs $15,000 and gets 25 mpg
- you resell any car after 5 years for 75% its original value
- you drive 10,000 miles in a year
- gas costs $2.50

What gas mileage would a new hybrid ($32,000) need to have in order for total costs for 5 years to be equal to the total costs for a normal car? Test different values in your program to find the correct answer. (1 point)

WHEN YOU PASS OFF, you will need to submit your code. To do this follow the instructions below:

- On your computer, navigate to the directory containing your eclipse project (clue: look at the top bar in eclipse).
- Find the .java files for the classes you have written.
- Attach these files to an email and send them to
.

If you have trouble, ask a neighbor or a TA.

If you use gmail (and possibly other webmail/email clients) you can simply drag and drop the .java file straight from Eclipse to attach it.