First Summer 2008


Homework Seven: Object-oriented programming.
Due date
Wednesday June 04, 11:59pm

Late policy
E-mail the solutions as a text file to Adrian by the due date.

Late submissions will be accepted for full credit if:

Work policy
Working in groups is encouraged but please turn in your own version of the assignment.

Also, please make sure you

with the Computer Science Department's Statement on Academic Integrity before turning in your assignment.

Task
Design a class of objects called Coin that:

Example:

coin = Coin()
for exp in range(20): 
    for i in range(1000):
        coin.flip()
    print coin.report()
    coin.reset()
Running the code above produces this:
>>>
Heads: 497, tails: 503
Heads: 502, tails: 498
Heads: 516, tails: 484
Heads: 484, tails: 516
Heads: 503, tails: 497
Heads: 489, tails: 511
Heads: 490, tails: 510
Heads: 500, tails: 500
Heads: 501, tails: 499
Heads: 501, tails: 499
Heads: 495, tails: 505
Heads: 487, tails: 513
Heads: 522, tails: 478
Heads: 493, tails: 507
Heads: 506, tails: 494
Heads: 505, tails: 495
Heads: 519, tails: 481
Heads: 510, tails: 490
Heads: 493, tails: 507
Heads: 500, tails: 500
>>> 
Above, we flip the coin 1000 times and report the result, then reset the coin.

We then do the same 19 times for a total of 20 experiments.

Grading
I will get back to you within two days of your submission.