BoxCars - -public static void main(String args final int...

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

View Full Document Right Arrow Icon
//******************************************************************** // Author: Lewis and Loftus // // Solution to Programming Project 4.3 (page xxx). //******************************************************************** public class BoxCars { //----------------------------------------------------------------- // Rolls a pair of dice multiple times, counting the number of // box cars (two sixes) that occur.
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 ROLLS = 1000, TARGET = 12; int total, count = 0; PairOfDice dice = new PairOfDice(); for (int roll=1; roll <= ROLLS; roll++) { total = dice.roll(); if (total == TARGET) count++; } System.out.println ("Number of rolls: " + ROLLS); System.out.println ("Number of Box Cars: " + count); } }...
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