Computer Science Canada What is wrong with this simple java program? |
Author: | Army_Hermet6312 [ Wed Sep 10, 2008 9:46 am ] |
Post subject: | What is wrong with this simple java program? |
I am attempting to make a simple program that will make a random bingo card for the user but i keep getting an error when i try to initalize the variables with random numbers, what am i doing wrong? // The "Exercise1" class. import java.awt.*; import hsa.Console; import java.lang.Math; public class Exercise1 { static Console c; // The output console public static void main (String[] args) { c = new Console (); // fist create arrays for each of the bingo sections int B [] = new int [5];// Place your program here. 'c' is the output console int I [] = new int [5]; int N [] = new int [5]; int G [] = new int [5]; int O [] = new int [5]; // the first thing we must do is initalize all the numbers with random integers for (int i = 1; i <=5; i++) { B(i) = (int)(15 * Math.random () + 1); } } // main method } // Exercise1 class |
Author: | rdrake [ Wed Sep 10, 2008 10:58 am ] | ||||
Post subject: | RE:What is wrong with this simple java program? | ||||
If memory serves correctly, you have two errors.
Oh, and in the future please use code or syntax tags like so: [ syntax = "Java" ] [ /syntax] Without the spaces of course. Java is painful enough to read as it is, it might as well be colourful. |