![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Nov 2005
Posts: 2
Rep Power: 0
![]() |
What is wrong with this code?
[code]//***********************************************************************
// xxxxx Project 4-4 11/26/05 // Design and implement a class called PairOfDice, with two six-sided // Die objects. Create a driver class called BoxCars with a main method // that rolls a PairOfDice object 1000 time, counting the number of box // cars (two sixes) that occur. //*********************************************************************** import cs1.Keyboard; import java.util.Random; import java.lang.Math; public class P4_4 { int sides = 6; // Creates the 2 die objects + and rolls them. Die Dice1 = new Die(sides); Die Dice2 = new Die(sides); Dice1.roll(); Dice2.roll(); System.out.println("You rolled a " +die1 +die2); // rolls the dice. public void roll() { DiceRoll = (int) (Math.random()*NUM_SIDES) + 1; } }[code] It keeps saying <identifier> expected on the Dice1.roll(); and the next 2 lines ARGHH. Im new to java and i dont understand what im doing wrong |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|