Exercise 1B.1 Test the following four functions
with the same set of inputs. Try to predict the outcome. Explain
the differences between the different results.
c1(f): ((f-32)*5)/9
c2(f): (f-32)*(5/9)
c3(f): (((f-32)/9)*5)
c4(f): (f-32*5/9)
Exercise 1B.2 Develop the function fToC that converts the temperature given in Fahrenheit to a temperature in Celsius. In this case represent all temperatures as integers, which is sufficient for weather reports.
Exercise 1B.3 Develop the function travelTime that computes how long a car trip takes (in hours and fractions of an hour), given the distance in miles and the estimated average speed in miles per hour.
Exercise 1B.4 Develop the function travelTimeInMinutes that computes how long a car trip takes (in minutes), given the distance in miles and the estimated average speed in miles per hour. Use the function travelTime as a helper function.
Exercise 1B.5 Develop the function numberOfPages that estimates the number of pages in a document, given the number of words in the document. Assume that a page has on the average 60 lines and a line has on the average 15 words in it.
Exercise 1B.6 Develop the function timeToDownload that estimates the time for downloading an image file from the web, given the pixel size and the download speed. The size of the picture is given by the number of pixels in each row and the number of rows of pixels. The download speed is given in the number of bytes per second. Each pixel requires three bytes.
Exercise 1B.7 Develop the function unitPrice that computes the unit price of a grocery item, given the weight and price of an item. The weight of the item is given in pounds and ounces. The price of the item is given in cents (i.e., for an item that costs $2.45 the price is given as the integer value 245).
Exercise 1B.8 Develop the function howManyTiles that computes how many tiles are needed to cover the floor during kitchen renovation, given the area of the kitchen and the size of the tile. The area of the kitchen is given in square feet. The size of the tile is given in inches. Assume the tiles are square.