ITEC 120 LAB 13 Back to Lab index page

Sam and Sue flip coins

You will write a driver program which uses the Coin class. Download Coin.java and put it in the same place as you put your lab13 java file.

Write a driver which simulates this game between Sam and Sue: Sam and Sue each have a coin. They are going to flip their coins. If both coins are the same, it's a tie. If the coins are different, heads wins. Report the winner.

A sample run will look like this:

Sue's toss: HEADS      Sam's toss: TAILS.

Congratulations Sue!

Another sample run:

Sue's toss: TAILS     Sam's toss: TAILS.

It's a tie!