1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
levacccp [35]
3 years ago
7

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 conside

ring 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.
Computers and Technology
1 answer:
hjlf3 years ago
4 0

Answer:

Task 1: T = c + (2.5n(A/M))+ m(1+r/100)ⁿ

Task 2: In both 5 & 10 years, Car A is more economical

Task 3: Printing returns the answer in a different dialogue box while return displays the answer in the same window.

Explanation:

Task 1:

C = Cost of car

n = Number of years

m = Maintenance Cost

r = Rate

M = Mileage per gallon

A = Annual mileage

T= Total Cost

T = c + (2.5n(A/M))+ m(1+r/100)ⁿ

Task 2

Car A In 5 years; T = 20000+ (2.5*5(15000/25))+1300(1+0.15)⁵= $30115

Car B In 5 years; T = 30000+ (2.5*5(15000/32))+1000(1+0.10)⁵= $37470

Therefore in 5 years, Car A is more economical.

Car A In 10 years; T = 20000+ (2.5*10(15000/25))+1300(1+0.15)¹⁰= $40259.225

Car B In 10 years; T = 30000+ (2.5*10(15000/32))+1000(1+0.10)¹⁰= $ 44312.49

Therefore in 10 years, Car A is still economical.

Task 3: Printing returns the answer in a different dialogue box while return displays the answer in the same window.

You might be interested in
SOMEONE PLEASE HELP ME OUT !!!!!!
GrogVix [38]

Answer:

not completly sure but i believe its the one that says inform the coach of where the goalies weak area...

Explanation:

8 0
2 years ago
Find the simple interest Jay owes on a five-year student loan of $48,000 with an annual interest rate of 5%.
borishaifa [10]
Use the equation I=prt where interest = principal times rate times time.

Fill it out, it becomes I= 48000(.05)(5)

I= 12000
3 0
3 years ago
What type of computer processing system is characterized by data that are assembled from more than one location and records that
ikadub [295]

Answer:

d) Online, real-time systems.

Explanation:

The options are:

a) Batch processing systems.

b) Personal computer systems.

c) Data compression systems.

d) Online, real-time systems.

And the correct option is D. Online, a real-time system. And this is because it is this which is characterized by the data which is assembled from more than one location as it is online, and various clients from various locations enter the data, and it's updated immediately, as it is a real-time system, which is updated in real-time. And hence D. is the correct option. The data compression system takes the data from one location at a time. The batch processing system is made up of different programs for input, output, and process. and hence is different from real-time, which requires continual all the three. And a PC is not made to a specific function, and it does different activities. Hence, its also not the right option here.

5 0
3 years ago
21. Dice Game Write a program that plays a simple dice game between the computer and the user. When the program runs, a loop sho
Brrunno [24]

Answer:

See Explanation Below

Explanation:

// Program is written in C++ programming language

//.. Comments are used for explanatory purposes

// Program starts here

#include<iostream>

#include <stdlib.h>

#include <time.h>

using namespace std;

int main()

{

int computerWins = 0, computerPlay = 0;

int userWins = 0, userPlay = 0;

int tiedGames = 0;

// Computer Play

for (int play = 0; play< 10; play++) {

   computerPlay = rolls();

   userPlay = rolls();  

   // Check who wins

//Clear Screen

System("CLS")

   if (computerPlay == userPlay) {

       tiedGames++;

cout<<"Ties........" + tiedGames;    }

else {

       if (computerPlay> userPlay) {

           computerWins++;

cout<<"Computer...."<< computerWins;

       } else {

           userWins++;

cout<<"User........"<< userWins;

      }

  }

}

return 0;

}

int rolls() {

srand((unsigned)time(0));

return rand() % 6 + 1;

}

5 0
3 years ago
What is cinematography?
Vikentia [17]
Cinematography is the art of making motion pictures.
5 0
3 years ago
Other questions:
  • IANA has primarily been responsible with assigning address blocks to five regional internet registries (RIR). A tech needs to re
    6·1 answer
  • I want to customize my company's logo, name, address, and similar details in all my business documents what option should use?
    12·1 answer
  • What category of predefined formulas in Excel contains the Boolean functions?
    14·1 answer
  • Three variables, x, y and z, supposedly hold strings of digits, suitable for converting to integers. Write code that converts th
    7·1 answer
  • Does the brain play a role in smartphone addiction
    7·2 answers
  • The _________ in an internet are responsible for receiving and forwarding packets through the interconnected set of networks and
    10·1 answer
  • Who was the founder of the location-sharing site Whrrl
    6·1 answer
  • A thesaurus is an example of a(n)
    5·2 answers
  • What is a typical use for a MAN?
    13·1 answer
  • What is the error in the following pseudocode?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!