Name: __________________________ NetID: _____________ Name: __________________________ NetID: _____________ Name: __________________________ NetID: _____________
For the following problems, first discuss an algorithm to solve the problem and then second try writing Python code (on paper) to solve the problem.
Consider the problem of adding units of measure together (like minutes and seconds). When you add the smaller units, e.g., seconds, they may "overrun" into the larger unit, e.g., minutes, you must update the larger unit and remove its value from the seconds total. For example, adding 20 seconds to 30 seconds results in 50 total seconds. But adding 20 seconds to 50 seconds, results in 1 minute and 10 seconds.
Consider the problem facing the owner of a movie theater who has complete freedom in setting ticket prices. The more he charges, the fewer the people who can afford tickets. In a recent experiment the owner determined a precise relationship between the price of a ticket and average attendance. At a price of $5.00 per ticket, 120 people attend a performance. Decreasing the price by a dime ($.10) increases attendance by 15. Unfortunately, the increased attendance also comes at an increased cost. Every performance costs the owner $180. Each attendee costs another four cents ($0.04). The owner would like to know the exact relationship between profit and ticket price so that he can determine the price at which he can make the highest profit.