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

19th Apr 2020, 5:04 PM
Zoe
Zoe - avatar
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
19th Apr 2020, 7:38 PM
Avinesh
Avinesh - avatar
+ 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.
19th Apr 2020, 6:05 PM
Avinesh
Avinesh - avatar
+ 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?
19th Apr 2020, 5:54 PM
Avinesh
Avinesh - avatar
+ 1
Zoe you're welcome. I'm glad it helped.
19th Apr 2020, 7:53 PM
Avinesh
Avinesh - avatar
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
19th Apr 2020, 6:01 PM
Zoe
Zoe - avatar
0
https://code.sololearn.com/cGannFFh2T1V/?ref=app Does this work, sorry I'm new to this
19th Apr 2020, 6:23 PM
Zoe
Zoe - avatar
0
Thank you so much!! That's much simpler then I had thought
19th Apr 2020, 7:47 PM
Zoe
Zoe - avatar