Online Hibernate Training just in Rs. 1000

One week online training in Hibernate ORM framework. Learn Hibernate Framework and enhance your skills. Best Online Hibernate training at 90% discount. Join Now!! Offer is valid Only for limited Period!!! Online Training Big Data and Hadoop Training Java Training  
 

console application - text-based menu

Ads

 
 

Share on Google+Share on Google+

brenz
console application - text-based menu
1 Answer(s)      7 years ago
Posted in : Java Beginners
Ads
View Answers

December 5, 2009 at 2:40 PM


Hi Friend,

Use Switch-Case in your program like the following:

import java.util.*;

class addproduct{
addproduct(){
System.out.println("I am the class addproduct");
}
}

class updateproduct{
updateproduct(){
System.out.println("I am the class updateproduct");
}
}

class deleteproduct{
deleteproduct(){
System.out.println("I am the class deleteproduct");
}
}

class viewproduct{
viewproduct(){
System.out.println("I am the class viewproduct");
}
}



public class productmain{
public static void main(String[] args) throws Exception {
Scanner scan = new Scanner(System.in);
int menu = 0;
System.out.println("Test");
System.out.println();
System.out.println("1. Add Product");
System.out.println("2. Update Product");
System.out.println("3. Delete Product");
System.out.println("4. View Product");
System.out.println("5. Exit");

boolean quit = false;
do{
System.out.print("Please enter your choice: ");
menu = scan.nextInt();
System.out.println();
switch(menu) {
case 1:
addproduct add=new addproduct();
break;
case 2:
updateproduct update=new updateproduct();
break;
case 3:
deleteproduct delete=new deleteproduct();
break;
case 4:
viewproduct view=new viewproduct();
break;
case 5:
quit = true;
break;
default:
System.out.println("Invalid Entry!");
}
}
while (!quit);
}
}

Thanks

Ads









Related Tutorials/Questions & Answers:
CONSOLE
class. Standard output is, on most operating systems, console output. format
menu
menu  Hi,i want write the menu that repeat several time
Advertisements
menu
menu  fibonaci & prime no. display in menu driven in java programme
Menu
Menu  Pl make a program which generates the following output. "Select from this menu" 1. Array 2. Stack 3. Queue. 4. Exit. If users press 1, then it will go in 1. Array. Welcome in Array. press 1. for Insertion press 2
How to Create Animated Main Menu Application with Java Swnig Buttons - Java Beginners
How to Create Animated Main Menu Application with Java Swnig Buttons  Hello sir I want to display Main Menu after Log in i have created Log in Form but I want More attractive Animated Main Menu which includes Following
Faces Console
Faces Console         The Faces Console is a FREE standalone Java Swing application for managing JavaServer Faces-based applications. With the Faces Console you
Struts Console
Struts Console         The Struts Console is a FREE standalone Java Swing application for managing Struts-based applications. With the Struts Console you can
Spring Console
Spring Console         The Spring Console is a FREE standalone Java Swing application for developing and managing Spring-based applications. With the Spring Console
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application
How to invoke other java class by selecting from dropdown menu... a dropdown menu to choose type of report and then click on submit button.On clicking... which he can generate report based on diffrent textfield values entered And vice
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application
How to invoke other java class by selecting from dropdown menu... a dropdown menu to choose type of report and then click on submit button.On clicking... which he can generate report based on diffrent textfield values entered And vice
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application
How to invoke other java class by selecting from dropdown menu... a dropdown menu to choose type of report and then click on submit button.On clicking... which he can generate report based on diffrent textfield values entered And vice
Invalid console appender in JBoss console
Invalid console appender in JBoss console  "ERROR: invalid console appender config detected, console stream is looping" The above is the error i am getting while starting the server after deploying the ear file into the jboss. I
menu problem
menu problem  Hi to all , I am inserting a menu in my jsp page.i have downloaded(free) a menu .In which 4 files are as below. 1... it to the tomcat and when i run my application , an extra link appears on my header
menu driven
menu driven   menu driven programm in decimal to binary binary to decimal
menu driven
menu driven  display the 1-30 prime no. and fibonacie series in menu driven programme
Menu Bar in Java
to create a Menu Bar in your application, First we need to import list of packages that required for creating a menu bar in an application. We defined a class name... Menu Bar in Java     
menu with scrollbar
menu with scrollbar  I want to use MenuBar with Scrollbar. I tried... and every component should inside the panel. I tried it but menu bar... java.awt.*; public class menu extends JFrame { MenuBar bar; Menu file,setting,rate,help
Add menu - IDE Questions
to develop web application but i cant find how to add menu item(not the case for java application where menu can be added from palette)so that when i run the application using browser i can see the menus and select accordingly,Plz help me.Thanks
how to clear r console
Programming language. I have done a lot of experiment and now the console is full of log. Now I want to clear r console. how to clear r console? Thanks   Hi, RGui is the console of R Programming language. You can run your r program
DropDown Menu
menu that has the list of Page 1- Page 5. if i select page 1 it will display only... is the problem.. for example; if i select page 1 in my dropdown menu, and click
Version of struts-menu>struts-menu dependency
List of Version of struts-menu>struts-menu dependency
ClearScreen in Console Java
ClearScreen in Console Java  How can I perform Clear Screen Operation in Java. As we used to do in C++ using clrscr(); Please guide
Version of com.dorkbox>Console dependency
List of Version of com.dorkbox>Console dependency
How to close R Console?
How to close R Console?  Hi, I am inside R console. How to close R Console? Thanks   Hi, R Console is used to run the R Program. You can write and test R Programs here. If you wish to close the session then type: q
HIBERNATE IN CONSOLE & SERVLET
for using Hibernate in a console application & a servlet. ... advisable to test the program as a console application. Once it is found to work... HIBERNATE IN CONSOLE & SERVLET ( part-3
soap message console - WebSevices
soap message console  hi friends i have one doubt that is iam using MyEclipse 6.0 in that how do i get soap message console
Creating Menu - MobileApplications
Creating Menu  Hi all, I am developing an application for nokia... and JDK 1.5 with Wireless toolkit and was able to create a simple application to display a text on the screen. I need to know the following things: How
Need help with console program?
Need help with console program?  Write a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed). thanks in advance.   Here is an example that repeatedly
java console programming - Java Beginners
java console programming  how to clear d screen in java console programming
creaing a menu - Java Beginners
creating a menu in JavaScript  How we can create a 3-level menu in java script
menu drive programm in java
menu drive programm in java  calculate area of circle, square,rectangele in menu driven programme in java