I have a question. Below is my driver, I've already written a class. The object of the program is to report a winner and loser based on a coin flip. Heads wins. I already have if (coin1.toString()==coin2.toString()) to take care of a tie. Hoiw do I report a winner for not a tie?
For instance, if Sue gets a heads and Sam gets a tail, how do I report Sue is the winner?
public class Coin2
{
public static void main (String[] args)
{
Coin coin1, coin2;
coin1 = new Coin();
coin2 = new Coin();
coin1.flip();
coin2.flip();
System.out.println ("Sue's toss: " + coin1.toString() + ", Sam's toss: " + coin2.toString());
if (coin1.toString()==coin2.toString())
System.out.println ("It is a tie!");
}
}