Code written for third example.

Not yet tested, no variables entered.