0
I need help with writing a program in Java
How would I take user input and replace any 2 with to without using the replace method and ideally using two main methods
7 odpowiedzi
+ 1
Hi Zoe this is a simple implementation of your code and it does the job. Make sure to go through it and let me know if you have any doubts, all of it is pretty much self explanatory.
https://code.sololearn.com/c82E4531hD9x/?ref=app
+ 3
Zoe Just a suggestion, whenever you ask for some help, do add your code with your question. It helps us directly address the problem and not ask any questions.
+ 2
What part of the code can you write by yourself? Have you learnt taking user input in Java? Do you know that a Java program cannot have 2 main methods with same signature? Also if you have planned to overload the main method, where is it useful in your case?
+ 1
Zoe you're welcome. I'm glad it helped.
0
Yes I have the user input and my program runs, but only changes one 2 to "to" but if I write a sentence, for example I have 2 go 2 the store, then it only changes the first 2 to "to". I am also unsure of this, but I think I have a main method and a sub method
0
https://code.sololearn.com/cGannFFh2T1V/?ref=app
Does this work, sorry I'm new to this
0
Thank you so much!! That's much simpler then I had thought