Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

multiple inputs

 
nick kaushik
Ranch Hand
Posts: 48
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i m building a program in core java which replaces chars in a text for user defined chars.for this i want the program to ask user as many time as he wants.program asks for both replaced as well as replacement & make changes to text?
 
Maneesh Godbole
Saloon Keeper
Posts: 11027
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nick,
Welcome to the Ranch.

How does your application interface with the user? Command line? Standalone GUI? Webpage?

In pseudo code
1) Request user input
2) Process user input
3) Confirm repeat from user.

A command line interface would involve running a while loop. A GUI would involve a confirmation dialog.
 
nick kaushik
Ranch Hand
Posts: 48
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to just do it-commandline or otherwise.although i used bufferedReader object.i used 3 different char for replaced,replacement & replace again? inputs & put them in do-while loop.....
 
nick kaushik
Ranch Hand
Posts: 48
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i m beginner, i m doing it on command prompt..
 
nick kaushik
Ranch Hand
Posts: 48
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well Manish, sorry its just that i didnt got a satisfying reply last time...so i posted the program.
i request you to delete tht last post & continue the program one...
 
Sean Clark
Rancher
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



This is the code from the other message.
I tested it and it works ok.

The only thing I would change for this simple app is maybe add in some simple validation - check they have entered a char otherwise ask them again.

and also just use one BufferedReader to read in the values, you don't need 3.

Sean
 
Vivek Kr Singh
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
check java.util.Scanner from JDK 5.0
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic