Hello,
I'm trying to build a basic java program to test what i know.
So far, it's not going anywhere.. lol
See my code below, as I have 1 main class called HOUSE, and subclasses called living.. kitchen.. and whatever
I have input variable like lenght and width and trying to "getarea". the result i'm getting is NULL.. and i don'T know why
Any ideas, and thanks for any support you may provide.
/**
*
* @author Daniel
*/
public class AlexHouse1 {
private static int Height = 12; // The height is the same for all rooms
private static int Lenght;
private static int Width;
private static int floors;
private static int HouseNumber = 33; // The House civic number
private static int HouseRooms = 4; // Number of room into the House
private static int YearConstruction = 2001;
private static String HouseStreet = "My street name"; // The Street name
private static String HouseCity = "Toronto"; // City Name
private static String HouseSize;
int temperature; // It's temperature, but i have not assiged value.
String HouseColor = "yellow"; // Outside color of the house
public class AlexHouse1Size {
public int Lenght = 0;
public int Width = 0;
public AlexHouse1Size(int a, int b){
Lenght = a;
Width = b;
}
public int getArea() {
return Lenght * Width;
}
AlexHouse1Size HouseSize = new AlexHouse1Size(12,15);
}
public class LivingRoom extends AlexHouse1 { // Subclaass Living Room
int LivingRoomLenght;
int LivingRoomWidth;
int LivingRoomLHeight = 8;
int LivingRoomSize;
String LivingRoomColor = "beige";
int LivingRoomTemperature;
}
public static void main(String[] args) {
AlexHouse1 House = new AlexHouse1(); // To create AlexHouse "object"
System.out.println("Alex House have a total of " + HouseRooms + " rooms");
System.out.println("and she was built in " + YearConstruction);
System.out.println("The house total height is " + Height);
System.out.println("The house size is " + HouseSize);
}
}