subject

You want to buy a new car, and you are thinking about two alternatives, car A and car B. You like both cars, and you are considering keeping whichever one you buy for many years to come. As a result, you want to evaluate the total cost of ownership of both cars over many years. Car A costs $20,000, whereas car B costs $30,000. Car A runs 25 miles with a gallon of gas, whereas car B runs 32 miles with a gallon of gas. You estimate that you will drive about 15,000 miles each year, and that gas price is going to be around $2.50 per gallon for the foreseeable future. The maintenance cost of car A is $1,300 in the first year, then that cost increases 15% (with compound growth) each year. The maintenance cost of car B is $1,000 in the first year, then that cost increases 10% (with compound growth) each year. Task 1. Write a method named compareCars(int years) that takes an integer number of years and prints a table with the total ownership cost of each car for each year, starting from year 0 which represents the time of purchase. The method will return the name of the most economical car on the last year. Note: For this problem, you are allowed to break the usual "no print statements inside a method" recommendation. Task 2. Using your method, answer this question: which car would you buy if you plan on keeping it for 5 years? 10 years? Discuss the results. Write your answer in a comment at the top of your code. Task 3. Answer this question: in a method, what is the difference between printing something and returning it? Write your answer in a comment at the top of your code.

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 24.06.2019 17:40, penacesar18p9jrdh
The value of sin(x) (in radians) can be approximated by the alternating infinite series create a function (prob3_2) that takes inputs of a scalar angle measure (in radians) and the number of approximation terms, n, and estimates sin(x). do not use the sin function in your solution. you may use the factorial function. though this can be done without a loop (more efficiently), your program must use (at least) one. you may find the mod() function useful in solving the problem.
Answers: 1
image
Computers and Technology, 25.06.2019 04:30, Teedollasign
Which relativos possible when two tables share the same primary key? a.) one-to-one b.) one-to-many c.) many-to-one d.) many-to-many
Answers: 2
image
Computers and Technology, 25.06.2019 05:30, pennygillbert
When a game allows you to pick party members from a large pool, each with different classes and roles but in which no single party combination is clearly superior to others, the game is using: intransitive relationships transitive relationships orthogonal relationships parallel relationships
Answers: 1
image
Computers and Technology, 25.06.2019 11:30, amoakoh800003
Give two reasons why cloud computing could be detrimental to a company.
Answers: 1
You know the right answer?
You want to buy a new car, and you are thinking about two alternatives, car A and car B. You like bo...

Questions in other subjects: