7 Replies - 1146 Views - Last Post: 17 August 2009 - 08:27 AM Rate Topic: -----

#1 ice_skate3   User is offline

  • D.I.C Head

Reputation: -6
  • View blog
  • Posts: 78
  • Joined: 13-March 09

hello! JAva.. i want delete...

Posted 13 August 2009 - 03:32 AM

i want to delete what I've typed in choose 1
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


Is This A Good Question/Topic? 0
  • +

Replies To: hello! JAva.. i want delete...

#2 mostyfriedman   User is offline

  • The Algorithmi
  • member icon

Reputation: 729
  • View blog
  • Posts: 4,473
  • Joined: 24-October 08

Re: hello! JAva.. i want delete...

Posted 13 August 2009 - 08:38 AM

i dont think you can delete the stuff in the console in java
Was This Post Helpful? 0
  • +
  • -

#3 pbl   User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8381
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: hello! JAva.. i want delete...

Posted 13 August 2009 - 07:53 PM

View Postmostyfriedman, on 13 Aug, 2009 - 07:38 AM, said:

i dont think you can delete the stuff in the console in java

Confirmed
The only way:
System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
Was This Post Helpful? 1
  • +
  • -

#4 ice_skate3   User is offline

  • D.I.C Head

Reputation: -6
  • View blog
  • Posts: 78
  • Joined: 13-March 09

Re: hello! JAva.. i want delete...

Posted 13 August 2009 - 11:56 PM

View Postpbl, on 13 Aug, 2009 - 06:53 PM, said:

View Postmostyfriedman, on 13 Aug, 2009 - 07:38 AM, said:

i dont think you can delete the stuff in the console in java

Confirmed
The only way:
System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");


hello man!

i cannot delete the one i typed in choice 1

you could try it and see!

:D
Was This Post Helpful? 0
  • +
  • -

#5 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6968
  • View blog
  • Posts: 31,958
  • Joined: 10-May 07

Re: hello! JAva.. i want delete...

Posted 14 August 2009 - 01:37 AM

View Postice_skate3, on 14 Aug, 2009 - 12:56 AM, said:

i cannot delete the one i typed in choice 1

You can't remove from standard out. Because standard out is output, it's like printing to a sheet of paper. It isn't a buffer or an object, it's output. Like spoken words.
Was This Post Helpful? 0
  • +
  • -

#6 ice_skate3   User is offline

  • D.I.C Head

Reputation: -6
  • View blog
  • Posts: 78
  • Joined: 13-March 09

Re: hello! JAva.. i want delete...

Posted 14 August 2009 - 01:54 AM

View Postno2pencil, on 14 Aug, 2009 - 12:37 AM, said:

View Postice_skate3, on 14 Aug, 2009 - 12:56 AM, said:

i cannot delete the one i typed in choice 1

You can't remove from standard out. Because standard out is output, it's like printing to a sheet of paper. It isn't a buffer or an object, it's output. Like spoken words.


well... someone solves it already...

^.^
Was This Post Helpful? 0
  • +
  • -

#7 FreezingDigits   User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 24
  • Joined: 17-July 09

Re: hello! JAva.. i want delete...

Posted 14 August 2009 - 02:19 AM

In the end ice_skate3 didn't want to delete what was seen in the output, he wanted to delete what was stored in the variables.

Simple case of miss communication, if that would of been made clear this would've been solved a long time ago.
Was This Post Helpful? 0
  • +
  • -

#8 ice_skate3   User is offline

  • D.I.C Head

Reputation: -6
  • View blog
  • Posts: 78
  • Joined: 13-March 09

Re: hello! JAva.. i want delete...

Posted 17 August 2009 - 08:27 AM

the one ive passed today was wrong.. nakz! they want a tail
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1