like when i finished typing the name, id.. bla bla bla..
and when i Choose 2 it will delete all like what I've type in 1
what code should i put in case 3?
}
public void addToTail(int el, String str) {
if (!isEmpty()) {
tail.next = new S(el,str);
tail = tail.next;
}
else head = tail = new S(el,str);
}
is this the ryt java code?
import java.util.*;
public class S
{
static Scanner kb=new Scanner(System.in);
public static void main(String [] args)
{
int id=0;
int age=0;
int menu=0;
String fname="",lname="";
char bol=0;
System.out.println();
System.out.println("MENU\n");
System.out.println("[1] ADD");
System.out.println("[2] DELETE");
System.out.println("[3] DISPLAY ALL");
System.out.println("[4] EXIT");
System.out.println();
do{
System.out.println();
System.out.print("Enter your CHOICE here: ");
menu=kb.nextInt();
switch(menu)
{
case 1:
System.out.println();
System.out.println("\nYou've Choose 1 ADD");
System.out.println();
System.out.print("Please Enter ID: ");
id=kb.nextInt();
System.out.print("First Name : ");
fname=kb.next();
System.out.print("Last Name : ");
lname=kb.next();
System.out.print("Age : ");
age=kb.nextInt();
break;
case 2:
System.out.println("\nYou have Choosen Delete");
break;
case 3:
System.out.println("\nYou Have Choosen Display All");
System.out.println();
System.out.println("ID: "+id);
System.out.println("First Name: "+fname);
System.out.println("Last Name: "+lname);
System.out.println("Age: "+age);
break;
case 4:
System.out.println("\nExit");
System.exit(0);
break;
default:
System.out.print("\nInvalid input\n\n");
break;
}
}while(menu !=0);
}
}
This post has been edited by Jayman: 13 August 2009 - 08:47 AM

New Topic/Question
Reply



MultiQuote





|