Q:

In How To 1.1, you made assumptions about the price of gas and annual usage to compare cars. Ideally, you would like to know which car is the better deal without making these assumptions. Why can’t a computer program solve that problem?

belongs to collection: Algorithm and pseudocode excersices

0

In How To 1.1, you made assumptions about the price of gas and annual usage to compare cars. Ideally, you would like to know which car is the better deal without making these assumptions. Why can’t a computer program solve that problem? 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

The Answer:

// Inputs are one way distance, beginning mileage, ending mileage, number of work days
// Question asks only for fraction "commuting to work" thus we don't need to count the fraction commuting back home
total miles traveled = ending mileage - beginning mileage
miles traveled to work = one way distance * number of work days
// This is what we want to know:
fraction of miles for commute = miles traveled to work / total miles traveled
// Personal use is whatever is left over
fraction of miles for personal use = 1 - fraction of miles for commute

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Suppose you put your younger brother in charge of ... >>
<< In order to estimate the cost of painting a house,...