Java Arrays with class input?
I have written a class that outlines sets the Length and the Width and has a Method to calculate the area. My driver Program has to prompt the user to enter the how many rooms they have which initialises the size of an array in which I have a for loop to as the user to enter the Length and Width. This I can do but how to I get the array to hold each variable so I may output the value. I have tried something like
Room roomNo = new Room /* to create a new room class
and double myRoom[] /* to initialise the array
and for every count on the for loop myRoom = newRoom.getLength
But this brings up a incompatible data type error
Please Help!!!!
Cheers
|