I need to complete this project by next Monday.
How do I do a menu selection
EXAMPLE:
Press 1 to enter the model number.
Press 2 to delete a record.
Press 3 to exit the program.
I'm doing this project on NetBean using Java.
Can someone please teach me?
Thanks!!!!
fairy1992224 0 Newbie Poster
Recommended Answers
Jump to Post— inspectorG4dget 0My java is a little rusty, but this should give you the basic idea (I'm doing this from memory, so the code might not compile just right, but you should be able to fix it from there):
BufferedReader reader = new BufferedReader(new InputStreamReader()); int choice = int(reader.readLine().trim()); …
Jump to Post— roxin_phoenix 0No I think. You can use the existing one.
Jump to Post— ajijacobm 0Ok. What kind of menu selection are you using? You can use the below code
import java.io.*; public test{ public static void main(String args[]) throws IOException { BufferedReader bfr= new BufferedReader(new InputStreamReader(System.in)); System.out.println("MENU"); System.out.println("enter a number"); int n=Integer.parseInt(bfr.readLine()); if(n==1) { //condition System.out.println("number is one"); } else if(n==2) …
All 10 Replies
inspectorG4dget 0 Newbie Poster
fairy1992224 0 Newbie Poster
roxin_phoenix 0 Newbie Poster
fairy1992224 0 Newbie Poster
ajijacobm 0 Light Poster
fairy1992224 0 Newbie Poster
ajijacobm 0 Light Poster
ajijacobm 0 Light Poster
Akill10 96 Posting Pro
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.