Write a CoinForFlipping
class that models a coin that can be flipped, with a random result of “heads” or “tails” each time the coin is flipped.
There are just two methods to the CoinForFlipping
class:
flip()
, which updates the state of the coin, andgetResult()
, which returns the state of the coinThen write a CoinFlipper
main program that demonstrates the use of the CoinForFlipping
class.
CoinForFlipping
is constructed, should the coin have a result already?