I am writing a simple program that is supposed to take a user input and convert it to char and for each char it should change it to the designated change.
I'm using switch statements to do this.

Ex.
blue
b = bravo
l = llama
u = union
e = excite

That is just an example.
This is just a console program and I am wondering if it is possible to do this within the console or if a JOptionPane has to be used?

if it can be done in the console can I please have a pseudo-code that I could try to implement.

Hope this stuff makes sense.

Yes you can do this as a console program. An idea would be to have a HashMap, where the key's are each letter from the alphabet, and the corresponding value is the String you want to replace it with. You could read in a text file to populate the HashMap (or hard-code it yourself, the text file is the better option though). Then when you take the input, say "blue", you would read each char into an array, and then simply loop through the array, matching the array value with the HashMap key.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.