Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



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

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


brenz
console application - text-based menu
1 Answer(s)      5 years and a month ago
Posted in : Java Beginners



Advertisement
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:
CONSOLE
class. Standard output is, on most operating systems, console output. format
menu
menu  fibonaci & prime no. display in menu driven in java programme
Advertisements
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
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
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
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
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
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  display the 1-30 prime no. and fibonacie series in menu driven programme
menu driven
menu driven   menu driven programm in decimal to binary binary to decimal
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
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     
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
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
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
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
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
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
java console programming - Java Beginners
java console programming  how to clear d screen in java console programming
menu driven programme
menu driven programme   calculate the area of circle, square, rectangle 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 drive programm in java
menu drive programm in java  calculate area of circle, square,rectangele in menu driven programme in java
creaing a menu - Java Beginners
creating a menu in JavaScript  How we can create a 3-level menu in java script
drop down menu
drop down menu  drop down menu using html
Menu s - JSP-Servlet
Menu s  How to create menubar & menus & submenus in jsp
Advertisements
 

 

 

DMCA.com