Simple Console Java Application Using NetBeans Hotel Menu Project

Hello Friends today I will explain Java techonology using Netbeans. In this projects we will learn how to create java console hotel menu projects step by step. We will also learn how to use netbeans and write a simple Java program using netbeans

Step 1

You should have any version of NetBeans installed in your machine.  I have installed NetBeans IDE 8.1 open NetBeans

Java

Step 2

Select Java language andJava Application in the projects section then click to next.

Java

Step 3

Enter the project name --  my project name is Hotel 1click to finish.

Java

Step 4

This is simple and easy to understand with comments section. 

  1. /* 
  2.  
  3. * To change this license header, choose License Headers in Project Properties. 
  4.  
  5. * To change this template file, choose Tools | Templates 
  6.  
  7. * and open the template in the editor. 
  8.  
  9. */  
  10. package hotel;  
  11. /** 
  12.  
  13. * 
  14.  
  15. * @author KrishnaRajput 
  16.  
  17. */  
  18. import java.util.Scanner; // using scanner class for accept the value by user at run time  
  19. public class Hotel {  
  20.     int choice;  
  21.     String menu;  
  22.     void show() {  
  23.         Scanner s = new Scanner(System.in);  
  24.         System.out.println("Enter your choice");  
  25.         System.out.println("Enter 1 for Coffee");  
  26.         System.out.println("Enter 2 for Tea");  
  27.         System.out.println("Enter 3 for Cold Drink");  
  28.         choice = s.nextInt();  
  29.         if (choice == 1) {  
  30.             System.out.println("you have select Coffee");  
  31.             System.out.println("menu");  
  32.             menu = s.nextLine();  
  33.         }  
  34.         if (choice == 2) {  
  35.             System.out.println("you have select Tea");  
  36.             System.out.println("menu");  
  37.             menu = s.nextLine();  
  38.         }  
  39.         if (choice == 3) {  
  40.             System.out.println("you have select Cold drink");  
  41.             System.out.println("menu");  
  42.             menu = s.nextLine();  
  43.         }  
  44.     }  
  45.     /** 
  46.  
  47.     * @param args the command line arguments 
  48.  
  49.     */  
  50.     public static void main(String[] args) {  
  51.         Hotel h = new Hotel();  
  52.         h.show();  
  53.         // TODO code application logic here  
  54.     }  
  55. }   

Step 5

Below is the screenshot output

Java

Thank you for reading. I hope this article was helpful for you. Please share any feedback or suggestions.

Ebook Download
View all
Learn
View all