• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

multiple inputs

 
Ranch Hand
Posts: 48
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i m beginner, i m doing it on command prompt..
 
nick kaushik
Ranch Hand
Posts: 48
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Rancher
Posts: 377
Android Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
check java.util.Scanner from JDK 5.0
 
I've got no option but to sell you all for scientific experiments. Or a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic