Java Reference
In-Depth Information
one inch on the library shelf (it will help to look at the size of any handy
book), yielding about 200 feet of shelf space for one million pages. If a
shelf is 4 feet wide, then 50 shelves are required. If a bookcase contains
5 shelves, this yields about 10 library bookcases. To reach this conclusion,
I estimated the number of pages per inch, the width of a shelf, and the
number of shelves in a bookcase. None of my estimates are likely to be
precise, but I feel confident that my answer is correct to within a factor of
two. (After writing this, I went to Virginia Tech's library and looked at
some real bookcases. They were only about 3 feet wide, but typically had
7 shelves for a total of 21 shelf-feet. So I was correct to within 10% on
bookcase capacity, far better than I expected or needed. One of my selected
values was too high, and the other too low, which canceled out the errors.)
Example2.19 Is it more economical to buy a car that gets 20 miles per
gallon, or one that gets 30 miles per gallon but costs $3000 more? The
typical car is driven about 12,000 miles per year. If gasoline costs $3/gallon,
then the yearly gas bill is $1800 for the less efficient car and $1200 for the
more efficient car. If we ignore issues such as the payback that would be
received if we invested $3000 in a bank, it would take 5 years to make
up the difference in price. At this point, the buyer must decide if price is
the only criterion and if a 5-year payback time is acceptable. Naturally,
a person who drives more will make up the difference more quickly, and
changes in gasoline prices will also greatly affect the outcome.
Example2.20 When at the supermarket doing the week's shopping, can
you estimate about how much you will have to pay at the checkout? One
simple way is to round the price of each item to the nearest dollar, and add
this value to a mental running total as you put the item in your shopping
cart. This will likely give an answer within a couple of dollars of the true
total.
2.8
Further Reading
Most of the topics covered in this chapter are considered part of Discrete Math-
ematics. An introduction to this field is Discrete Mathematics with Applications
by Susanna S. Epp [Epp10]. An advanced treatment of many mathematical topics
useful to computer scientists is Concrete Mathematics: A Foundation for Computer
Science by Graham, Knuth, and Patashnik [GKP94].
 
Search WWH ::




Custom Search