public class Main{

	//global variable
	
	static Scanner kbin = new Scanner(System.in);
	
	public static void main(String[] args){
	
		String guestName = getGuestName();
		int roomNumber = getRoomNumber();
		int roomPrice = getRoomPrice();
		
		//TO DO 1: write a line of code to create a new ticket instance/object using the 3 variables above
		
		//TO DO 3: write a line of code to call the printTicket function
		
		
	    
	}
	
	
	//printTicket processes a Ticket object, simply displaying all 3 Ticket properties/attributes
	public static void printTicket(Ticket newTicket){
	
		//To DO 2: print all newTicket properties
	
	}
	
	public static String getGuestName() {
		String name;
		System.out.println("Enter guest name: ");
		name = kbin.nextLine();
		
		return name;
	}
	
	public static int getRoomNumber() {
		
		int roomNum;
		
		while (true) {
            System.out.print("Enter room number, between 100 and 999: ");
            try {
                roomNum = kbin.nextInt();
                while(roomNum<100||roomNum>999){
                    System.out.print("Invalid entry, between 100 and 999: ");
                    roomNum = kbin.nextInt();
                }
                break;
            } catch (InputMismatchException e) {
                System.out.println("Invalid input. Please enter a number.");
                 
            }
        }
        
        kbin.nextLine(); //flush the input buffer after entering an int
        
        return roomNum;
        
        
	}
	
	public static int getRoomPrice() {
		int roomPrice;
		
		while (true) {
            System.out.print("Enter room price: ");
            try {
                roomPrice = kbin.nextInt();
                while(roomPrice<0){
                    System.out.print("Positive numbers only: ");
                    roomPrice = kbin.nextInt();
                }
                break;
            } catch (InputMismatchException e) {
                System.out.println("Invalid input. Please enter a number.");
                 
            }
        }
        
        kbin.nextLine(); //flush the input buffer after entering an int
        
        return roomPrice;
	}
}
