Home Answers Viewqa Java-Beginners console application - text-based menu

 
 


brenz
console application - text-based menu
1 Answer(s)      3 years and 6 months ago
Posted in : Java Beginners

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 Pages:
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
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
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
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
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
CONSOLE
class. Standard output is, on most operating systems, console output. format
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
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
menu
menu  Hi,i want write the menu that repeat several time
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
Menu Control in Flex4
Menu Control  in Flex4: The Menu contol is a pop-up control. It containes a submenu. You can select a indivisual item from menu control. You use only Actionscript for create a pop-up Menu control. There is no MXMl tag. You can
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     
Dynamic Dropdown Menu
Dynamic Dropdown Menu       Put records from your database in a drop down menu/list box. You can apply... is open the mysql console and type the following: create table car_list (c_id int
How to Creating Pop Up Menu in PHP?
How to Creating Pop Up Menu in PHP?  Hi, I am a beginner in the PHP Application. Can somebody give an example of how to creating pop up Menu in PHP. Please feel free to suggestion........ Thanks
jQuery Drop Down Menu
jQuery Drop Down Menu       In this JQuery tutorial we will develop a program  to make Drop Down menu Steps to develop the Drop Down menu . Step 1:         Create
Menu Bar in Java
for creating a menu bar in an application. We defined a class name... Menu Bar in Java       A Menu Bar is a set of option that allow the user to choose from any one
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
Dojo Menu and Menu Item
Dojo Menu and Menu Item     ... the menu and how to create it in dojo. Menu : This is the widget models a context menu, otherwise known as a right-click or popup menu, and it appears
Dojo Menu and Menu Item
Dojo Menu and Menu Item     ... the menu and how to create it in dojo. Menu : This is the widget models a context menu, otherwise known as a right-click or popup menu, and it appears
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
Creating Menu Using Canvas Class
Creating Menu Using Canvas Class       This example shows how to create the menu and call... on Canvas form. The application look like as follows:   Source Code
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
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
mobile application
login with the registered id password..after it der must be to menu color menu and shape menu as soon as we click any of shape say square and from color menu red
Alphabetical DropDown Menu In JSP
Alphabetical DropDown Menu In JSP   ... application . We created five file adduser.jsp, addform.jsp, userUpdate.jsp and delete.jsp.  Brief description of the flow of the application
converter application
converter application  Develop a converter application using event-driven programming paradigm of Java. Procedure: 1. Design a menu bar with two menus. 2. The first menu has the following menu items, Distance, Currency
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
Building a J2ME sliding menu with text and images(part-2)
Building a J2ME sliding menu with text and images(part-2... these sliding menu in J2ME. Code to create back and forward button images...();   }   }  The Application
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
First Hibernate Application
; Java Application or, Select from the menu bar tab Run -> Run or, press... the application output will be as follows : 1. On console of Eclipse the output...First Hibernate Application In this tutorial you will learn about 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
Menus
also develop an application with a Menu. As a name indicates a Menu consists of Menu objects. These Menu objects comprise of MenuItem objects which can...() method. The program code given below, creates an application window with a menu
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
menu drive programm in java
menu drive programm in java  calculate area of circle, square,rectangele in menu driven programme in java
menu driven programme
menu driven programme   calculate the area of circle, square, rectangle in menu driven programme in java
Menu s - JSP-Servlet
Menu s  How to create menubar & menus & submenus in jsp
drop down menu
drop down menu  drop down menu using html
Menu Bar prob.
Menu Bar prob.  I want a menu to be displayed in each page of my swing appl. how to go abt
java console programming - Java Beginners
java console programming  how to clear d screen in java console programming
highlight menu item html
highlight menu item html  highlight menu item in html or CSS   <body id="index"> <div id="menu"> <ul> <li class...; </ul> </div> <!-- menu --> </body>
creating pop up menu
creating pop up menu   how to create a pop up menu when a link in html page is clicked using jquery? and the link should be a text file   Please visit the following links: http://www.roseindia.net/tutorial/jquery
context menu overlapped in IE8
context menu overlapped in IE8  I developed a contex menu in XHTML while opening it is overlapped in border of IE8 browser. even i have tried change the zaxis in css. I am using like below
Jquery Slide-up Menu
Jquery Slide-up Menu  Hello, Excellent site. I am learning Jquery and I can produce a slide-down menu but don't know how to make a slide-up menu/nav bar to go at the bottom of the web page. Can you show a way how this can

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.