| Date Assigned: | Mon Oct-30 |
| Date Due: | Tue Oct-31 |
Solve each of the following problems with a C++ program which uses Monte Carlo methods. At the start of class tomorrow, you will demonstrate your code by running it (quickly). Please place all solutions in one main(). Make the output readable, and use getchar's as necessary so it doesn't scroll off-screen.
1. How many times must you flip a coin before it is likely that you will see 3 heads?
2. You drive the same road to school every day, and it has a railroad crossing. Northbound trains, loaded with coal, are slow -- they arrive every 20 minutes (starting at 5am) and take 5 minutes to pass. Southbound trains, empty, are fast -- they arrive every 20 minutes (starting at 5:10am) and take 2 minutes to pass. You arrive at some random time every day between 6:30am and 7:00am. How long is your average wait for trains to clear?
3. The Pennsylvania Lottery (see http://www.palottery.com/) allows you to "Play It Boxed" in the Daily Number Lottery (see http://www.palottery.com/daily.htm). Basically, with this strategy, you pick 3 numbers from 0 to 10, say 563, and you win if the 3 numbers chosen match the ones you selected in any order. So, if you choose 563 Boxed, and the Daily Numbers are 356, you win! The lottery pays out 80 to 1 if you win this way (so a $1 bet pays out $80). Say you start with $100 and make a $1 boxed bet each day. How many days on average until you run out of money?