Coin Toss

Write a program CoinToss.java that asks the user to hit the [Enter] key to flip a virtual coin. The program then prints out either “heads” or “tails” with a random probability of either event happening.

Variation

Write a String method .flip() that returns a value of heads or tails each time it is called. Call that method from the main() program.