CS2133 hw 1 #3

CS2133 hw 1 #3 - { dienum2[j]++; } } } public static void...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
// Matt Hergenrether // CS 2133 // February 11, 2009 // Homework 1 #1 // Arrays and scanning in values import java.util.*; // util contains the Scanner class import java.util.Random; class PairOfDice { int x; int y; int[] dienum1 = new int[7]; int[] dienum2 = new int[7]; public class die1(int a) { x = a; for(int i=0; i<=6; i++) { if(i == x) { dienum1[i]++; } } } public class die1(int b) { y = b; for(int j=0; j<=6; j++) { if(j == y)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { dienum2[j]++; } } } public static void main(String args) { int roll1; int roll2; Random generator = new Random(); for(int k=0; k&lt;=1000; k++) { roll1 = generator.nextInt(6); roll2 = generator.nextInt(6); if(roll1 == 6 &amp;&amp; roll2 ==6) { die1 i = new die(roll1); die2 i = new die(roll2); } } } System.out.println(&quot;The number of boxcars was &quot; + dienum1[6]); }...
View Full Document

Page1 / 2

CS2133 hw 1 #3 - { dienum2[j]++; } } } public static void...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online