title: Building construction with array list in java
body: <p>I am a beginer developer and I have to do a java program with an array list. The program is a building constructor in which i must create entrances , floors and apartments in an array list and the program has to work with user iputs using the console. And for example if I want to create an apartment on the 10th floor but there are only 9 floors it has to give me an error message. That is what I did Here is a part of the code:</p>
  
  <pre><code>public class Building {
      static String answer;
  
  public static void main(String[] args) {
      // TODO code application logic here
      Scanner input = new Scanner(System.in);
  
      List&lt;Entrance&gt; entrance = new ArrayList&lt;Entrance&gt;();
      List&lt;Floors&gt; floor = new ArrayList&lt;Floors&gt;();
      List&lt;Apart&gt; apartment = new ArrayList&lt;Apart&gt;();
  
      System.out.println("Welcome, choose (A) for operations and (B) for information!");
      answer = input.nextLine();
  
      if(answer.equals("A")){
          System.out.println("Chose (A) to create entrance , (B) to create floor and (V) to create apartment");
          answer = input.nextLine();
  
          if(answer.equals("A")){
  
  
              System.out.println("Creating entrance...");
  
              Entrance entranceA = new Entrance();
  
              entrance.add(entranceA);
  
  
              System.out.println("Create the name of the entrance:");
              entranceA.setNameEntrance(input.nextLine());
  
  
              System.out.println("How many floors are in this part of the building:");
              entranceA.setNumberFloors(input.nextInt());    
                }
  
  
          }else if(answer.equals("B")){
  
              System.out.println("Creating a floor...");
  
              Floors floorA = new Floors();
              floor.add(floorA);
  
              System.out.println("How many aparments are on this floor:");
              floorA.setNumberApart(input.nextInt());
  
  
  
  
  
  
  
      }
  
  
  }
  </code></pre>