HtDP Problem Set | Section 4 |
Develop the function within?, which consumes three numbers representing the x and y coordinates of a point and the radius r of a circle centered around the origin It returnstrue
if the point is within or on the circle. It returnsfalse
otherwise. The distance of the point to the origin is the square root of x2 + y2.
A local discount store has a policy of putting labels with dates on all of its new merchandise. If an item has not sold within two weeks the store discounts the item by 25% for the third week, 50% for the fourth week, and 75% for the fifth week. After that no additional discounts are given.Develop the function new-price, which takes the initial price of an item and the number of weeks since the item was dated and produces the selling price of the item.
A manufacturing company measured the productivity of its workers and found that between the hours of 6am and 10am they could produce 30 pieces/hour/worker; between 10am and 2pm they could produce 40 pieces/hour/worker; and between 2pm and 6pm they could produce 35 pieces/hour/worker.Develop a function that takes an hour of the day between 6am and 6pm, in twenty-four hour format, along with the number of workers and computes the total number of pieces produced during that hour.
An Internet service provider charges a base rate per megabyte (MB) transferred depending on market conditions. In addition to the base, transfers between 100 and 500 MB are charged an additional $0.05/MB plus 33% of the base. Data transfers between 500 MB and 1500 MB are charged 1.44 times the base plus $0.08/MB. Above 1500 MB the rate is simply twice the base. All data in a transfer is charged the same rate. For example, if 1600 MB are transfered, then the charge for all 1600 MB is twice the base.Develop the function bill-amount, which takes an amount of data transferred in megabytes and a base rate in dollars and computes the total charge.
Develop a function to calculate total tax liability for ANY given income. Assume that the share of income $35,000 and below is federally taxed at 15%, the share of income between $35,000 and $100,000 is taxed at 25%, and the share of income over $100,000 is taxed at 35%. Assume that there is no state income tax for income up to $50,000 but is a flat 5% for all income above $50,000.
Jamie Raymond | Matthias Felleisen |
01 december 2003 |