/* Java application illustrating the use of objects of the TossableCoin2 class. */ public class TossableCoin2App { public static void main(String[] args) { // Create a new coin object and assign it to variable 'coin'. TossableCoin2 coin = new TossableCoin2(); // Toss the coin several times, each time displaying the result. for (int i=1; i <= 10; i = i+1) { coin.toss(); System.out.println(coin); } // Report how many times each of HEADS and TAILS was tossed. System.out.println("\n# times coin was tossed: " + coin.tossCount()); System.out.println("# times Heads was tossed: " + coin.headsCount()); System.out.println("# times Tails was tossed: " + coin.tailsCount()); } }