hotel booking system - arraylist , compilation errors
===

I can store some values in my all arraylist when i choose option 'a'.
But when i go to option 'b' and try to retrieve what i had type and store in variable rq (to check the number of rooms booked) and using it for loop in option 'b' to loop it. But the all array is empty.

I am also having a "error" when i compile.

In option 'b' for loop, i did this 

	for(int i=0;i<all.get(4);i++)

but i get an error [error: bad operand types for binary operator '<'].

So i decided to cast it.

    for(int i=0;i<(Integer)all.get(4);i++)

There is no error now but compilation seems faulty. 

Note: C:\Users\MegaStore\Desktop\java testing\RoomSelection.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

So im wondering if those values i typed in are in the heap , or deleted by the garbage collector when i choose option 'b'.

My code is not fully typed out yet but want to solve the problem at hand.

My program also needs to record how many add-ons (max is 4) that the user wants and store it. So i am not too sure where to add and store it.

import java.util.*;
import java.io.*;

public class test123{
	
	public test123()throws InputMismatchException {
				
		String choiceStr;//initialize choiceStr which is use for reading lines from scanner input
		char choiceChar;//initialize choiceStr which is use for reading character from scanner input
		int choice,rt,rq,ao1,night,ao2,quan;//initialize choiceStr which is use for reading integer from scanner input
		String datee;
		String[] roomType = new String[5]; //Initialize a array for room type
		roomType[0]="Single Room"; //To be added to array roomType
		roomType[1]="Double Room"; //To be added to array roomType
		roomType[2]="Deluxe Room"; //To be added to array roomType
		roomType[3]="Junior Room"; //To be added to array roomType
		roomType[4]="Suite";  //To be added to array roomType
		Integer[] priceRoom = new Integer[5]; //Initialize a array for room prices
		priceRoom[0]=160; //To be added to array room price
		priceRoom[1]=200; //To be added to array room price
		priceRoom[2]=280; //To be added to array room price
		priceRoom[3]=380; //To be added to array room price
		priceRoom[4]=500; //To be added to array room price
		Integer[] priceAdd = new Integer[4]; //Initialize a array for add-on prices
		priceAdd[0]=25; //To be added to array add-on price
		priceAdd[1]=60; //To be added to array add-on price
		priceAdd[2]=70; //To be added to array add-on price
		priceAdd[3]=100; //To be added to array add-on price      
		ArrayList all = new ArrayList();
		Scanner input= new Scanner(System.in); //Initialize a scanner input
	
		System.out.println("Room Selection");
		System.out.println("==============\n");
		System.out.println("[a] Room Type");
		System.out.println("[b] Add-Ons");
		System.out.println("[c] Main Menu");
		System.out.println("Type 'a' to select Room Type and state the desire quantity for each type.");
		System.out.println("Type 'b' to select the Add-Ons.");
		System.out.println("Type 'c' to exit from  the Booking Menu.");
		System.out.println("Please enter your option (a, b or c): ");
		
		;
		choiceStr = input.nextLine();
		choiceChar = choiceStr.charAt(0); 

		switch(choiceChar){
			case 'a':	System.out.println("Room Type");
						System.out.println("=====================================================");
						System.out.println("(1) Single Room (1 person) - Price: S$160");
						System.out.println("(2) Double Room (2 persons) - Price: S$200");
						System.out.println("(3) Deluxe Room (2 persons) - Price: S$280");
						System.out.println("(4) Junior Suite (2 persons) - Price: S$380");
						System.out.println("(5) Suite (2 persons) - Price: S$500\n");
						System.out.println("Enter Room types (Enter '1' to '5')");
						rt=input.nextInt();
						while(rt>5){
							if(rt>5){
							System.out.println("Please enter number between '1' to '5'!");
							rt=input.nextInt();
							}					
						}
						
						String roomTypess= roomType[rt-1];
						all.add(roomTypess);
						int storePricee = priceRoom[rt-1];
						all.add(storePricee);

					
						System.out.println("Number of rooms required (maximum 10): ");
						rq=input.nextInt();
						while(rq>10){		
							if(rq>10){
							System.out.println("Please enter again!");
							rq=input.nextInt();
							}
						}
						all.add(rq);
						
						final int parse = rq;
							
						for(int i=0;i<parse;i++){
							System.out.println("Enter the date of checked-in (dd/mm/yy) for "+all.get(0) +" " + (i+1));
							datee = input.nextLine();
							datee = input.nextLine();
							all.add(datee);
							System.out.println(datee);
							System.out.println("Enter number of Add-on for "+all.get(0) + " " +(i+1)+": ");
							ao1=input.nextInt();
							while(ao1>4){
							if(ao1>4){	
								System.out.println("Please enter again! Choose only option 1 to 4");
								ao1=input.nextInt();
								}							
							}
							all.add(ao1);			
							System.out.println("Number of night(s) required (maximum 30) for "+all.get(0) + " " +(i+1)+ ": ");
							night=input.nextInt();
							while(night>30){	
								if(night>30){
								System.out.println("Please enter again! Maximum is 30 days!");
								night=input.nextInt();
								}
							}
							all.add(night);

							
						}
						System.out.println("no of rooms book: "+(Integer)all.get(0));
	
						new RoomSelection();	
						break;	
									
			case 'b':		System.out.println("Room req is empty? : "+all.isEmpty());
							System.out.println("Add-Ons");
							System.out.println("=====================================================");
							System.out.println("(1) Breakfast voucher (1 person) per day - Price: S$25");
							System.out.println("(2) Spa voucher (1 person) - Price: S$60");
							System.out.println("(3) Half Day Tour voucher (1 person) - Price: S$70");
							System.out.println("(4) Full Day Tour voucher (1 person) - Price: $100\n");
							
				
								
							for(int i=0;i<(Integer)all.get(4);i++){
											
							System.out.println("Enter Add-On option");
							ao2=input.nextInt();
							while(ao2>4){
								if(ao2>4){	
									System.out.println("Please enter again! Choose only option 1 to 4");
									ao2=input.nextInt();
								}							
							}
		
							all.add(ao2);
							System.out.println("Enter quantity required for Add-On option " + (i+1)+": ");
							quan=input.nextInt();

							all.add(quan);
							}

						break;
			case 'c':	new MainPage1();break;
			default:;
		}
		
	}

}
	
	
	
	
	
	
