Ok
the task here to generate a random number either 0 or 1
if its 0 then the fish will be red
if its 1 then the fish will be blue
here is the code i've written..
help me with it..
//Welcoming users
System.out.println("WELCOME TO THE AQUARIUM STIMULATIONS");
// CONSTRUCT OBJECTS NEEDED FOR THE AQUARIUM SIMULATION.
// Construct the aquarium. Specify its dimensions when creating it.
Aquarium aqua; // create reference to an Aquarium ...
//aqua = new Aquarium(600, 480);// ... object that has now been created
aqua = new Aquarium(100, 480);// ... object that has now been created
//generating a random value
Random randNumGen = RandNumGenerator.getInstance();
int randomNum = randNumGen.nextInt();
Color fishColor = new Color();
//consturcting a fish
AquaFish AquariumFish = new AquaFish(aqua);
//creating three new fish
AquaFish aquaFish1 = new AquaFish(aqua);
// -----------------------------------------------------------------
AquaFish aquaFish2 = new AquaFish(aqua);
// -----------------------------------------------------------------
AquaFish aquaFish3 = new AquaFish(aqua);
//---------------------------------------------------------------
if (randomNum == 1){
(fishColor(Color.blue));
}
if (randomNum =0){
fishColor.setColor(Color.red);
}
I need help with how to set the color...
thanks
plz reply asap.
Heh, I don't think you need help anymore..cuz..it's sort of an old post. i wish I register earlier
haha i had to write a code like that except it was a coin and its sides and not a fish and its colors