TestCoin -...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // TestCoin.java Author: Lewis/Loftus // // Solution to Programming Assignment 5.6 //******************************************************************** / public class TestCoin { //----------------------------------------------------------------- // Flips a coin multiple times and counts the number of heads // and tails that result. Locks and unlocks coins
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //-----------------------------------------------------------------public static void main (String args) { final int NUM_FLIPS = 25; int key = 10; Coin myCoin = new Coin(); // instantiate the Coin object myCoin.setKey(key); for (int count=1; count <= NUM_FLIPS; count++) { myCoin.flip(); System.out.println(myCoin); if (count % 10 == 0) myCoin.lock(key); else if (count % 5 == 0) myCoin.unlock(key); } } }...
View Full Document

This note was uploaded on 05/17/2011 for the course COP 3530 taught by Professor Davis during the Spring '08 term at University of Florida.

Ask a homework question - tutors are online