GE (General Electric) Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/


/**
*
* @author djoshi
*/

import java.util.ArrayList;

class House {

private ArrayList<Room>rooms;

House(){
rooms=new ArrayList<Room>();
}

public Room getRoom(int roomNum){
return this.rooms.get(roomNum);
}

public void addRoom(Room room){
this.rooms.add(room);
}

public int getNumRooms(){
return this.rooms.size();
}

}

class Room {

private int numberOfTVs;
private int length;
private int width;
private Wall wall;
private Flooring flooring;
private TemperatureControl temperatureControl;

Room(){

}

Room(int length,int width,Wall wall,
Flooring flooring,int numberOfTVs,
TemperatureControl temperatureControl){
this.length=length;
this.width=width;
this.wall=wall;
this.flooring=flooring;
this.numberOfTVs=numberOfTVs;
this.temperatureControl=temperatureControl;
}

public Wall getWall(){
return wall;
}

public Flooring getFlooring(){
return flooring;

}

public int getArea(){
return length*width;
}

public int getNumberOfTVs(){
return numberOfTVs;
}

public TemperatureControl getTemperatureControl(){
return temperatureControl;
}

}

class Kitchen extends Room{

private ArrayList<String>appliances;

Kitchen(int length,int width,Wall wall, Flooring flooring,int numberOfTVs, TemperatureControl temperatureControl, ArrayList <String> appliances){
super(length, width, wall, flooring, numberOfTVs, temperatureControl);
this.appliances=appliances;
}

public int getNumberOfAppliances(){
return appliances.size();
}

}

class Bedroom extends Room{

private boolean attachedBathroom;
private int numberOfBeds;

Bedroom(int length,int width,Wall wall,Flooring flooring,int numberOfTVs, TemperatureControl temperatureControl, boolean attachedBathroom,
int numberOfBeds){
super(length, width, wall, flooring, numberOfTVs, temperatureControl);
this.attachedBathroom=attachedBathroom;
this.numberOfBeds=numberOfBeds;
}

public boolean isBathroomAttached(){
return this.attachedBathroom;
}

public int getNumberOfBeds(){
return this.numberOfBeds;
}

}

class Bathroom extends Room{

private String bathSize;

Bathroom(int length, int width, Wall wall, Flooring flooring, int numberOfTVs, TemperatureControl temperatureControl,String bathSize){
super(length, width, wall, flooring, numberOfTVs, temperatureControl);
this.bathSize=bathSize;
}

public String getBathSize(){
return this.bathSize;
}

}

class Wall{

private String color;
private String texture;

Wall(String color,String texture){
this.color=color;
this.texture=texture;
}

public String getColor(){
return color;
}

public String getTexture(){
return texture;
}

}

class Flooring{

private String material;
private String color;
private String condition;

Flooring(String material,String color,String condition){
this.material=material;
this.color=color;
this.condition=condition;
}

String getMaterial(){
return this.material;
}

String getColor(){
return this.color;
}

String getCondition(){
return this.condition;
}

}

class TemperatureControl{

private boolean heated;
private boolean cooled;
private String methodOfCooling;

TemperatureControl(boolean heated,boolean cooled, String methodOfCooling){
this.heated=heated;
this.cooled=cooled;
this.methodOfCooling=methodOfCooling;
}

public boolean isHeated(){
return heated;
}

public boolean isCooled(){
return cooled;
}

public String GetMethodOfCooling(){
if(cooled){
return methodOfCooling;
}else{
return "Room is Not Cooled";
}
}

}

- dhaval0129 September 13, 2010 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More