• Post Reply Bookmark Topic Watch Topic
  • New Topic

Terminal type 'interface'  RSS feed

 
Jon Brasted
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

May I please have some help implementing an 'interface', responding to user input like this... ?

[Run class]
"Welcome. Please enter your name: "
[user inputs his/her name]
"Thank you. Welcome 'name'. How may I help you?"
"1. I would like a drink."
"2. I would like some food."
"3. I want to go home."
[user types in 1]
"Here is a drink."
etc

I can take arguments when first running the class (e.g. java bar -name Jon -do 1) but I am not sure how I would turn that into a terminal type interface as described above.

I appreciate any help.

Thanks a lot.
Jon
[ February 14, 2005: Message edited by: Jon Brasted ]
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A broad hint to start ... We write to the console with System.out. Can you take a guess at what we use to read from the console? Start browsing the JavaDoc for System and see what you find. A little warning ... reading is kinda non-trivial. Come back if you get stuck.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!