import java.util.Arrays; import java.util.Scanner; public class 9 { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); String[] roomList = new String[7]; //hotel room numbers int filledElements = 0; // number of hotel rooms String roomNum; //entered hotel room number System.out.print("Enter hotel room number (or q to quit): "); roomNum = stdIn.nextLine(); while (!roomNum.equalsIgnoreCase("q") && filledElements < roomList.length) { if (roomNum.length() < 1 || roomNum.length() > 6) { System.out.println("Invalid entry." + "Must enter between 1 and 16 characters."); } else { roomList[filledElements] = roomNum; filledElements++; } System.out.print("Enter hotel room number (or q to quit): "); roomNum = stdIn.nextLine(); } //end while System.out.println("\n The Occupied rooms:"); for (int i=0; i= 0) { System.out.println("Room is occupied " + index) ; } else { System.out.println("room is free"); }//end main } //end class 9