UsingDie - Die die2 = new Die(6); // Roll both dice...

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

View Full Document Right Arrow Icon
// File: UsingDie.java // Author: Amber Settle // Purpose: To demonstrate how to use the programmer-defined // class Die / import java.util.Scanner; i public class UsingDie { public static void main(String[] args) { // Create two dice, each with 6 sides Die die1 = new Die(6);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Die die2 = new Die(6); // Roll both dice die1.roll(); die2.roll(); int num1 = die1.getFace(); int num2 = die2.getFace(); System.out.println("You rolled a " + num1 + " and a " + num2 + " for a total of " + (num1 + num2)); } }...
View Full Document

This note was uploaded on 03/05/2011 for the course CSCI 384 taught by Professor Drchan during the Spring '11 term at CA Health Sciences.

Ask a homework question - tutors are online