Jump to content

Help in Java

PugoOfficial

So here's the codes:

How can I make the program not show the previous printed features of the room when the user chooses to back and another question how do I make the program input the user's(guest) info and saves it in the system thanks in advance! PS: I am using Java(JCreator LE)

import java.io.*;public class Reservation{    public static void main(String[]args)throws IOException{         main();     }    public static void main() throws IOException{        System.out.println("\n================== WELCOME TO Marimar Bay Sands Hotel! =========================\n");                System.out.println("\tAt Marimar Bay Sands Hotel all room types are tastefully\n\tdecorated and fully furnished, ensuring the highest level\n\tof comfortand tranquility to each guest.\n");                        System.out.println("1 :  List of Rooms");        System.out.println("2 :  Inquiry\n");                int x;        BufferedReader br= new BufferedReader(new InputStreamReader(System.in));        x = Integer.parseInt(br.readLine());         int y= rooms(x);                       }     public static int rooms(int x) throws IOException{                  BufferedReader r = new BufferedReader(new InputStreamReader(System.in));                  if (x == 1){                          System.out.println("\n========================= Standard Collection ==============================\n");                        System.out.println("1 :  Single Room");            System.out.println("2 :  Double Room");            System.out.println("3 :  Junior Suite");            System.out.println("4 :  Family Suite");            System.out.println("6 :  Grande Suite");                                    System.out.println("\n========================= Premier Collection ==============================\n");                        System.out.println("6  :  Premier Double Room");            System.out.println("7  :  Premier Junior Suite");            System.out.println("8  :  Honeymoon Suite");            System.out.println("9  :  Penthouse Suite");            System.out.println("10 :  Presidential Suite");                                                        int  room;            BufferedReader  rr = new BufferedReader(new InputStreamReader(System.in));            room = Integer.parseInt(rr.readLine());                            System.out.println("");                            switch (room)            {                                    case 1:                                System.out.println("\nSingle Room");                                        System.out.println("* Double bed");                System.out.println("* Sitting corner with Sofa or Armchairs");                System.out.println("* Bathroom with Shower");                System.out.println("* Branded bath amenities");                System.out.println("* Hairdryer");                System.out.println("* Bathrobes and Slippers");                System.out.println("* Safe Deposit Box");                System.out.println("* LCD TV with satellite channels");                System.out.println("* Mini-Bar");                System.out.println("* Air conditioning");                System.out.println("* Steamer & amenities for making Coffee & Tea");                System.out.println("* Balcony or Terrace");                                System.out.println("\n\n0 :  Back to the List of Rooms");                                int b1;                BufferedReader r1 = new BufferedReader(new InputStreamReader(System.in));                b1 = Integer.parseInt(r1.readLine());                                if ( b1 == 0) {                                        System.out.print("");                }                                            rooms(room);                break;                                                case 2:                                    System.out.println("\nDouble Room");                                        System.out.println("* Double or Twin beds");                System.out.println("* Sitting corner with Sofa or Armchairs");                System.out.println("* Bathroom with Shower");                System.out.println("* Branded bath amenities");                System.out.println("* Hairdryer");                System.out.println("* Bathrobes and Slippers");                System.out.println("* Safe Deposit Box");                System.out.println("* LCD TV with satellite channels");                System.out.println("* Mini-Bar");                System.out.println("* Air conditioning");                System.out.println("* Steamer & amenities for making Coffee & Tea");                System.out.println("* Balcony or Terrace");                                System.out.println("\n\n0 :  Back to the List of Rooms");                                int b2;                BufferedReader r2 = new BufferedReader(new InputStreamReader(System.in));                b2 = Integer.parseInt(r2.readLine());                                if ( b2 == 0) {                                        System.out.print("");                }                                            rooms(room);                break;                                                    case 3:                                        System.out.println("\nJunior Suite");                                        System.out.println("Separate Bedroom");                System.out.println("* Living Room");                System.out.println("* Bathroom with Shower");                System.out.println("* Branded bath amenities");                System.out.println("* Hairdryer");                System.out.println("* Bathrobes and Slippers");                System.out.println("* Safe Deposit Box");                System.out.println("* 2 LCD TVs with satellite channels");                System.out.println("* Mini-Bar");                System.out.println("* Air conditioning");                System.out.println("* Steamer & amenities for making Coffee & Tea");                System.out.println("* Balcony or Terrace");                                System.out.println("\n\n0 :  Back to the List of Rooms");                                int b3;                BufferedReader r3 = new BufferedReader(new InputStreamReader(System.in));                b3 = Integer.parseInt(r3.readLine());                                if ( b3 == 0) {                                        System.out.print("");                }                                            rooms(room);                break;                                                case 4:                                System.out.println("\nFamily Suite");                                        System.out.println("* 2 Separate Bedrooms (1 with king size bed and 1 with bunk beds)");                System.out.println("* Living Room");                System.out.println("* 1 Bathroom with Shower");                System.out.println("* Branded bath amenities");                System.out.println("* Hairdryer");                System.out.println("* Bathrobes and Slippers");                System.out.println("* Safe Deposit Box");                System.out.println("* 2 LCD TVs with satellite channels");                System.out.println("* Mini-Bar");                System.out.println("* Air conditioning");                System.out.println("* Steamer & amenities for making Coffee & Tea");                System.out.println("* Balcony or Terrace");                                System.out.println("\n\n0 :  Back to the List of Rooms");                                int b7;                BufferedReader r7 = new BufferedReader(new InputStreamReader(System.in));                b7 = Integer.parseInt(r7.readLine());                                if ( b7 == 0) {                                        System.out.print("");                }                                            rooms(room);                break;                                                case 5:                                System.out.println("\nGrande Suite");                                        System.out.println("");                                System.out.println("\n\n0 :  Back to the List of Rooms");                                int b8;                BufferedReader r8 = new BufferedReader(new InputStreamReader(System.in));                b8 = Integer.parseInt(r8.readLine());                                if (b8 == 0) {                                        System.out.print("");                }                                            rooms(room);                break;                                                case 6:                                System.out.println("\nPremier Double Room");                                        System.out.println("* Magnificent View to the foothills of Mountain Pirin");                System.out.println("* Modern Italian designed furniture and cozy decoration");                System.out.println("* Double Bed");                System.out.println("* Sitting corner with Sofa or Armchairs");                System.out.println("* Bathroom with Shower");                System.out.println("* Luxury brand bath amenities");                System.out.println("* Hairdryer");                System.out.println("* Bathrobes and Slippers");                System.out.println("* Safe Deposit Box");                System.out.println("* LCD TV 32’’ with satellite channels & DVD player");                System.out.println("* Mini-Bar");                System.out.println("* Air conditioning");                System.out.println("* Steamer & amenities for making Coffee & Tea");                System.out.println("* Breakfast in room (upon request)");                System.out.println("* Early purchase of ski center passes, no waiting in queue required");                                System.out.println("\n\n0 :  Back to the List of Rooms");                                int b9;                BufferedReader r9 = new BufferedReader(new InputStreamReader(System.in));                b9 = Integer.parseInt(r9.readLine());                                if ( b9 == 0) {                                        System.out.print("");                }                                            rooms(room);                break;                                                case 7:                                System.out.println("\nPremier Junior Suite");                                        System.out.println("");                                System.out.println("\n\n0 :  Back to the List of Rooms");                                int b10;                BufferedReader r10 = new BufferedReader(new InputStreamReader(System.in));                b10 = Integer.parseInt(r10.readLine());                                if ( b10 == 0) {                                        System.out.print("");                }                                            rooms(room);                break;                                                case 8:                                System.out.println("\nHoneymoon Room");                                        System.out.println("");                                System.out.println("\n\n0 :  Back to the List of Rooms");                                int b11;                BufferedReader r11 = new BufferedReader(new InputStreamReader(System.in));                b11 = Integer.parseInt(r11.readLine());                                if ( b11 == 0) {                                        System.out.print("");                }                                            rooms(room);                break;                                                case 9:                                System.out.println("\nPenthouse Suites");                                        System.out.println("");                                System.out.println("\n\n0 :  Back to the List of Rooms");                                int b14;                BufferedReader r14 = new BufferedReader(new InputStreamReader(System.in));                b14 = Integer.parseInt(r14.readLine());                                if ( b14 == 0) {                                        System.out.print("");                }                                            rooms(room);                break;                                                case 10:                                System.out.println("\nPresidential Suites");                                        System.out.println("");                                System.out.println("\n\n0 :  Back to the List of Rooms");                                int b15;                BufferedReader r15 = new BufferedReader(new InputStreamReader(System.in));                b15 = Integer.parseInt(r15.readLine());                                if ( b15 == 0) {                                        System.out.print("");                }                                            rooms(room);                break;                               }                                                           main();        }           else if (x == 2){                        System.out.println ("RESRVATION!!!");                }                           else{                        System.out.println("Thank You!");        }                       return x;    }    public static int prod(int x) throws IOException{                return x;    }        }

CPU: Intel Core i7-4790K @ 4.0GHz | COOLING: Corsair H100i Liquid Cooler | MOTHERBOARD: ASUS Maximus VII Formula ATX | MEMORY: Corsair Vengeance Pro Series 16GB (2 x 8) DDR3-1866 | STORAGE: Intel 730 Series 480GB SSD + Seagate Barracuda 3TB HDD | PSU: Corsair AX860i 80+ Platinum | GPU: ASUS GeForce GTX 780Ti DirectCU II (2-Way SLI) | CASE: Phanteks Enthoo Luxe (Black) | DISPLAY: ASUS PB278Q 27.0" (2560 x 1440) | KEYBOARD: Razer BlackWidow Chroma | MOUSE: Razer Deathadder Chroma | SOUND: Logitech Z906 5.1 Speakers / Razer Kraken Chroma | OS: Microsoft Windows 8.1 (64-bit)

Link to comment
Share on other sites

Link to post
Share on other sites

I can only guess that this is what you wanted:

 

http://stackoverflow.com/questions/7522022/how-to-delete-stuff-printed-to-console-by-system-out-println

 

 

I am not aware of any way to clear the console output other than that.

DayZ Forum Moderator, DayZ Developer, ARMA 3: 2017 Developer, System-Admin, Gameserver-Admin, always interested to learn something new as well as new people.

Link to comment
Share on other sites

Link to post
Share on other sites

I can only guess that this is what you wanted:

 

http://stackoverflow.com/questions/7522022/how-to-delete-stuff-printed-to-console-by-system-out-println

 

 

I am not aware of any way to clear the console output other than that.

 

Um... Console.Clear

 

"Using the Clear method is equivalent invoking the MS-DOS cls command in the command prompt window."

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

Thanks @kichilron I just made spacing illusion (filled it with System.out.println() ;) But one more thing unanswered is how do I make the user(the guest) input his INFORMATION when checking in or inquiring and save it inside the system for example Mr.Guest is already occupying this room or this room is unavailable

 

Edit: Sorry for having to many question but when I press 2 and prints it's features and if I choose back it goes back to the marimar bay sands how do I make it return to the list of rooms :)

CPU: Intel Core i7-4790K @ 4.0GHz | COOLING: Corsair H100i Liquid Cooler | MOTHERBOARD: ASUS Maximus VII Formula ATX | MEMORY: Corsair Vengeance Pro Series 16GB (2 x 8) DDR3-1866 | STORAGE: Intel 730 Series 480GB SSD + Seagate Barracuda 3TB HDD | PSU: Corsair AX860i 80+ Platinum | GPU: ASUS GeForce GTX 780Ti DirectCU II (2-Way SLI) | CASE: Phanteks Enthoo Luxe (Black) | DISPLAY: ASUS PB278Q 27.0" (2560 x 1440) | KEYBOARD: Razer BlackWidow Chroma | MOUSE: Razer Deathadder Chroma | SOUND: Logitech Z906 5.1 Speakers / Razer Kraken Chroma | OS: Microsoft Windows 8.1 (64-bit)

Link to comment
Share on other sites

Link to post
Share on other sites

 

 

Good job on posting a command that can't be used in Java. There is no such command in Java.

DayZ Forum Moderator, DayZ Developer, ARMA 3: 2017 Developer, System-Admin, Gameserver-Admin, always interested to learn something new as well as new people.

Link to comment
Share on other sites

Link to post
Share on other sites

Good job on posting a command that can't be used in Java. There is no such command in Java.

I believe the only way it to print a number of blank lines that will "push" the prints off so you have a clean screen.

//print 20 blank lines to clear screenfor(int i=1; i<20; i++){System.out.println();}

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

 

I believe the only way it to print a number of blank lines that will "push" the prints off so you have a clean screen.

 

 

That's what I thought as well. The link I posted above should describe how to as well.

DayZ Forum Moderator, DayZ Developer, ARMA 3: 2017 Developer, System-Admin, Gameserver-Admin, always interested to learn something new as well as new people.

Link to comment
Share on other sites

Link to post
Share on other sites

Good job on posting a command that can't be used in Java. There is no such command in Java.

 

LOL. Apologies this was done when I was functioning on no sleep and about to go on a business trip.

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×