import java.util.Random;
class Building
{
private int w, h;
private int numberOfWins;
public Building(int width, int height)
{
w = width;
h = height;
// generating random windows. can be between 1 and 10
Random rand = new Random();
numberOfWins = rand.nextInt(9) + 1;
}
public int getWidth() { return w; }
public int getHeight() { return h; }
public int numberOfWindows() { return numberOfWins; }
public String toString()
{
return "a black building, width: " + width + ", height: " + height +
", has " + numberOfWins + " windows";
}
}
----------------------------------------------------
then you can create some Building objects and output them!