JLabel in JPanel Programming Software Development by helixkod … a random color color = new Color( randomNumbers.nextInt (256), randomNumbers.nextInt(256), randomNumbers.nextInt(256)); fill = randomNumbers.nextBoolean (); //add to the list to be… JLabel status bar that displays counts of random shapes Programming Software Development by Mark_61 … color = new Color(this.randomNumbers.nextInt(256), this.randomNumbers.nextInt(256), this.randomNumbers.nextInt(256)); boolean filled = this.randomNumbers.nextBoolean(); this.lines[count] = new… Creating Rectangles amd ovals Programming Software Development by helixkod …generate a random color Color color = new Color( randomNumbers.nextInt (256), randomNumbers.nextInt(256), randomNumbers.nextInt(256)); //add to the list to be… a random color Color color = new Color( randomNumbers.nextInt (256), randomNumbers.nextInt(256), randomNumbers.nextInt(256)); //add to the list to be… JLabel status bar Programming Software Development by shyla …); // generate a random color color = new Color (randomNumbers.nextInt (NUMBER_COLORS), randomNumbers.nextInt (NUMBER_COLORS), randomNumbers.nextInt (NUMBER_COLORS)); fill = randomNumbers.nextBoolean (); // construct a MyRectangle object rects… Couple of Histogram Problems Programming Software Development by Philosophy …- rangeNums[0]) + rangeNums[0]; } } else { randomNumbers[a] = rand() - 16000; } if(randomNumbers[a] < rangeNums[0]) //count numbers below and… above range boundaries { belowRange++; } else if(randomNumbers[a] > rangeNums[20]) { aboveRange++; } } for … Re: Java Arrays and Random Numbers Programming Software Development by matthewkeating …] public class arraySum { public static void main( String args[] ) { int randomNumbers[] = new int [100]; for(int i = 0; i<100… Random number generator with seed Programming Software Development by Violet_82 …RandomIntegers { public static void main( String[] args ) { Random randomNumbers = new Random(); // random number generator int face; // …{ // pick random integer from 1 to 6 face = 1 + randomNumbers.nextInt( 6 ); System.out.printf( "%d ", face );… Re: Java Arrays and Random Numbers Programming Software Development by matthewkeating … array to the sortNumbers method. } public static int[] sortNumbers( int randomNumbers[] ) { int evenNumbers[] = {}; int oddNumbers[] = {}; // Declare 2 arrays, one for even… Java Arrays and Random Numbers Programming Software Development by matthewkeating …[], int evenNumbers[] ) { for (int j = 0; j < randomNumbers.length; j++) { if ( randomNumbers[j] % 2 == 0) { evenNumbers+=randomNumbers[j]; } else { oddNumbers+=randomNumbers[j]; } } } [/code] Re: Java Arrays and Random Numbers Programming Software Development by matthewkeating … look like this? [CODE] for (int j = 0; j < randomNumbers.length; j++, int elementindexE = 0; int elementindexO = 0); { if… Finding a prime Number Programming Software Development by Fatima_110 …version number or a date) */ public class RandomNumbers { public RandomNumbers() { } public boolean isEven( int randomNos… = randNos.nextInt(15)+1; RandomNumbers test1 = new RandomNumbers(); boolean isEven = test1.isEven(number… Re: Couple of Histogram Problems Programming Software Development by Dingbats change line 48 to: randomNumbers[a] = rand() % ((rangeNums[21] - 1) - rangeNums[0]) + rangeNums[0]; (all slots occupied) change lne 91 to: if(countOccurances[d] != 0) (no extra '*' printed with multiples of 10) then it seems to work. I hate working with comparison with numbers in loops but it is sometimes so unavoidable! Nice program. Re: Couple of Histogram Problems Programming Software Development by Philosophy [QUOTE=Dingbats;1413207]change line 48 to: randomNumbers[a] = rand() % ((rangeNums[21] - 1) - rangeNums[0]) + rangeNums[0]; (all … Re: Couple of Histogram Problems Programming Software Development by Philosophy … more and I managed to get it to work with: randomNumbers[a] = rand() % ((rangeNums[20] + 1) - rangeNums[0]) + rangeNums[0]; I… Netbeans "build successful" but have two errors Programming Software Development by lynnajoe … the bottom that read: int die1 = 1 + randomNumbers.nextInt(6); int die2 = 1 + randomNumbers.next(6); I assumed that because this code…"); } public int rollDice() { int die1 = 1 + randomNumbers.nextInt(6); int die2 = 1 + randomNumbers.next(6); int sum = die1 + die2; System.out… Re: Netbeans "build successful" but have two errors Programming Software Development by mvmalderen Add the following line: [ICODE]private static final Random randomNumbers = new Random();[/ICODE] under: [I]// create random … in method rollDice[/I] [ICODE]int die2 = 1 + randomNumbers.next(6);[/ICODE] must change to: [ICODE]int die2 =… 1 + randomNumbers.next[B][COLOR="Green"]Int[/COLOR][/B](6… Re: Java Arrays and Random Numbers Programming Software Development by NormR1 [QUOTE] getting error saying that the datatype for arraySum is not applicable for sortNumbers[/QUOTE] Please copy and paste here the full text of the error message. [CODE]int randomNumbers[] = {(int)(100.0 * Math.random()) + 1};[/CODE] What do you want to happen with this statement? Re: Java Arrays and Random Numbers Programming Software Development by JamesCherrill public static void sortNumbers( int oddNumbers[], int evenNumbers[] ) sortNumbers( randomNumbers ); So here we have a method declaration that requires two int arrays as parameters And we have a method call that passes only one int array as parameter. That's not legal Java. Re: Java Arrays and Random Numbers Programming Software Development by matthewkeating So in this case I would have to do: [CODE] evenNumbers[elementIndex] = randomNumbers[j] [/CODE] So in the for loop I would have to add elementindex and set it to 0; int elementindex = 0,0 ? And then in the loop: elementindex++; Is this correct? Re: building a simple airline reservation system exercise Programming Software Development by Violet_82 …private int secondSeat; //private boolean seatAvailable; Random randomNumbers = new Random(); //constructor public Seats(){ //initializing…6 and 10 int theSeat = 6 + randomNumbers.nextint(PASSENGER_CLASSES); return theSeat; } }//end of… Java Help!! Programming Software Development by DaveNY …simulate rolling of dice 36000 times public void rollDice() { Random randomNumbers = new Random(); int face1; // number on first die …1; roll <= 36000; roll++ ) { face1 = 1 + randomNumbers.nextInt( 6 ); face2 = 1 + randomNumbers.nextInt( 6 ); totals[ face1 + face2 ]++; } // end for //… Re: Java Help!! Programming Software Development by qkerby …times public void rollDice([COLOR=Blue]int rolls[/COLOR]) { Random randomNumbers = new Random(); int face1; // number on first die…lt;= [COLOR=Blue]rolls[/COLOR]; roll++ ) { face1 = 1 + randomNumbers.nextInt( 6 ); face2 = 1 + randomNumbers.nextInt( 6 ); totals[ face1 + face2 ]++; } // end for … Question about printing an array Programming Software Development by cproud21 … = 0; index < time.length; index++) { Random randomNumbers = new Random(); hours = randomNumbers.nextInt(); minutes = randomNumbers.nextInt(); System.out.println(); time[index] = new TimeAT… Multiplication Problems Programming Software Development by countrygirl1970 …from user public void init() { Random randomNumbers = new Random(); // random number generator… 0; counter < 10; counter ++) { randomValue1 = randomNumbers.nextInt (biggestValue - smallestValue ) + 1; // random numbers … random name counter Programming Software Development by java2000 … { Scanner key = new Scanner(System.in); Random randomNumbers = new Random(); int n = 0; String[] …people: " + n ); int x = randomNumbers.nextInt(n); System.out.println(names[x]); names2[index2…command.equals("n")) { x = randomNumbers.nextInt(n); System.out.println(names[x]); names2… Rolling Dice Programming Software Development by ttuck …) { // TODO Auto-generated method stub Random randomNumbers = new Random(); int die1; int die2; …;= 1000; roll++){ die1 = 1 + randomNumbers.nextInt(6); die2 = 1 + randomNumbers.nextInt(6); totals[die1 + die2]++; }… urgent!!...need help with arrays Programming Software Development by levraheit …catch (NumberFormatException e) { } } Random randomNumbers = new Random(); int number1 = randomNumbers.nextInt(9); int number2… [HELP] Java Assignment Programming Software Development by Goyle …; public class RandomDice { public static void main(String [] args) { Random randomNumbers = new Random(); int die1; int die2; int [] totals = new int… roll = 1; roll <= 5; roll++) { die1 = 1 + randomNumbers.nextInt(6); die2 = 1 + randomNumbers.nextInt(6); totals[roll] = die1 + die2; } System.out… Enum initializing Programming Software Development by GeekTool … java.util.Random; public class Craps { private static final Random randomNumbers = new Random(); private enum Status { COUNTINUE, WIN, LOST }; private …play ends public int rollDice() { int toplam; int dice1 = 1 + randomNumbers.nextInt(6); //first dice roll int dice2 = 1… Need a little help Programming Software Development by broodwich …import javax.swing.*; public class Assignment6 extends JApplet{ private Random randomNumbers = new Random(); private enum Status { Right, Wrong …true) { int number1 = 1 + randomNumbers.nextInt( 10 ); // first die roll int number2 = 1 + randomNumbers.nextInt( 10 ); // second die …