• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Peter Rooke
Bartenders:

Multi Dimensional Arrays and nextBoolean

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm trying to solve a problem and have come to the stage of tearing my hair out! Basically I want to create a java program that produces a console display like so.
x0xx0
0x00x
0xxx0
xxx00
0000x
The rows and columns must be randomly filled.
I believe that one needs to use a two dimensional array to achieve this problem and have come across/ modified the following code out of two java problems.
THIS PROGRAM BASICALLY PRINTS OUT AN ARRAY OF 5 x 5 numbers.

THE NEXT PROGRAM I CAME ACROSS USES nextBoolean TO ASSIGN RANDOM LETTERS TO A GRID AND THEN REPEATS THE RANDOM GRID A NUMBER OF TIMES.

The RandomValuesTrue.java program is nearly what I want, regrettably it only prints out one column to the console.
Please, please, please can someone help me two work out how to generate a random grid using the code I've created in RandomValuesTrue and stop me from becoming prematurely bald?
Thanks for your help.
Julain
[ edited to preserve formatting using the [code] and [/code] UBB tags -ds ]
[ April 07, 2004: Message edited by: Dirk Schreckmann ]
 
Ranch Hand
Posts: 283
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another way, maybe.
reply
    Bookmark Topic Watch Topic
  • New Topic