console application - text-based menu

console application - text-based menu

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









Related Tutorials/Questions & Answers:
ModuleNotFoundError: No module named 'console-menu'
ModuleNotFoundError: No module named 'console-menu'  Hi, My Python... 'console-menu' How to remove the ModuleNotFoundError: No module named 'console-menu' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'python-console-menu'
ModuleNotFoundError: No module named 'python-console-menu'  Hi, My... named 'python-console-menu' How to remove the ModuleNotFoundError: No module named 'python-console-menu' error? Thanks   Hi
Advertisements
ModuleNotFoundError: No module named 'python-console-menu'
ModuleNotFoundError: No module named 'python-console-menu'  Hi, My... named 'python-console-menu' How to remove the ModuleNotFoundError: No module named 'python-console-menu' error? Thanks   Hi
ModuleNotFoundError: No module named 'python-console-menu'
ModuleNotFoundError: No module named 'python-console-menu'  Hi, My... named 'python-console-menu' How to remove the ModuleNotFoundError: No module named 'python-console-menu' error? Thanks   Hi
Spring Boot Console Application
-based application that prints messages on console using the Spring Boot. We...Spring Boot Tutorial- Spring Boot Console Application Welcome to the first... the source code of the Spring Boot Console Application and import in Eclipse IDE
Spring Boot Console Application
-based application that prints messages on console using the Spring Boot. We...Spring Boot Tutorial- Spring Boot Console Application Welcome to the first... can download the source code of the Spring Boot Console Application
CONSOLE
class. Standard output is, on most operating systems, console output. format
menu
menu  Hi,i want write the menu that repeat several time
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. (adsbygoogle = window.adsbygoogle || []).push
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 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 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
ModuleNotFoundError: No module named 'console'
ModuleNotFoundError: No module named 'console'  Hi, My Python... 'console' How to remove the ModuleNotFoundError: No module named 'console... to install padas library. You can install console python with following command
ModuleNotFoundError: No module named 'console'
ModuleNotFoundError: No module named 'console'  Hi, My Python... 'console' How to remove the ModuleNotFoundError: No module named 'console... to install padas library. You can install console python with following command
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
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
Version of com.dorkbox>Console dependency
List of Version of com.dorkbox>Console dependency
Version of struts-menu>struts-menu dependency
List of Version of struts-menu>struts-menu dependency
how to exit gremlin console
how to exit gremlin console  Hi, I am working on gremlin and don't know how to exit from the console correctly? What is the command? Thanks   Hi, to exit from the gremlin console type following command: :exit
how to exit gremlin console
how to exit gremlin console  Hi, I am working on gremlin and don't know how to exit from the console correctly? What is the command? Thanks   Hi, to exit from the gremlin console type following command: :exit
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
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
Maven Repository/Dependency: struts-menu | struts-menu
Maven Repository/Dependency of Group ID struts-menu and Artifact ID struts-menu. Latest version of struts-menu:struts-menu dependencies...? How to create Maven Web Application in Eclipse? Maven 3 Tutorial Convert
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
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
java console programming - Java Beginners
java console programming  how to clear d screen in java console programming
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
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
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
ModuleNotFoundError: No module named 'ae-console'
ModuleNotFoundError: No module named 'ae-console'  Hi, My Python... 'ae-console' How to remove the ModuleNotFoundError: No module named 'ae-console' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'annasys-console'
ModuleNotFoundError: No module named 'annasys-console'  Hi, My... named 'annasys-console' How to remove the ModuleNotFoundError: No module named 'annasys-console' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'annasys-console'
ModuleNotFoundError: No module named 'annasys-console'  Hi, My... named 'annasys-console' How to remove the ModuleNotFoundError: No module named 'annasys-console' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'annasys-console'
ModuleNotFoundError: No module named 'annasys-console'  Hi, My... named 'annasys-console' How to remove the ModuleNotFoundError: No module named 'annasys-console' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'appier-console'
ModuleNotFoundError: No module named 'appier-console'  Hi, My... named 'appier-console' How to remove the ModuleNotFoundError: No module named 'appier-console' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'aws-console'
ModuleNotFoundError: No module named 'aws-console'  Hi, My Python... 'aws-console' How to remove the ModuleNotFoundError: No module named 'aws-console' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'console-functions'
ModuleNotFoundError: No module named 'console-functions'  Hi, My... named 'console-functions' How to remove the ModuleNotFoundError: No module named 'console-functions' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'Console-Tools'
ModuleNotFoundError: No module named 'Console-Tools'  Hi, My... 'Console-Tools' How to remove the ModuleNotFoundError: No module named 'Console-Tools' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'Console-Utility'
ModuleNotFoundError: No module named 'Console-Utility'  Hi, My... named 'Console-Utility' How to remove the ModuleNotFoundError: No module named 'Console-Utility' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'dpaste-console'
ModuleNotFoundError: No module named 'dpaste-console'  Hi, My... named 'dpaste-console' How to remove the ModuleNotFoundError: No module named 'dpaste-console' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'github-console'
ModuleNotFoundError: No module named 'github-console'  Hi, My... named 'github-console' How to remove the ModuleNotFoundError: No module named 'github-console' error? Thanks   Hi, In your python

Ads