Unit 5 demo - CoinFlipper
//
// CoinFlipper.java
//
public class CoinFlipper
{
public String flip()
{
if (Math.random() < .5)
return "Heads";
else
return "Tails";
}
}
//
// CoinFlipperTest.java
//
public class CoinFlipperTest
{
public static void main(String[] args)
{
CoinFlipper flipper = new CoinFlipper();
for (int i=0; i<10; i++)
System.out.println(flipper.flip());
}
}