Inactive Tutor answered 10/03/19
Greetings!
I have attached code for a working solution to this...
That does not mean it is the only way to do it, or is the best way to do it, it is just one possible solution.
Hope this helps,
David
Inactive Tutor
Yes, the curly braces are not needed in the case sections, but, I always include them for readability; it is just my adopted coding standard and a habit I cannot break.10/03/19
Ashley P.
I understand! And what about the input() part? Is that also a compulsory line?10/04/19
Inactive Tutor
When we create a Scanner, if we do not do a .close() on it, eclipse or other tools will nag us that we did not close it, whenever you open a reader or writer, you should always close it. I am assuming that is what you were talking about.10/04/19
Ashley P.
I coded using the NetBeans IDE and did not write that line and there were no errors and the code executed smoothly. Thats why I10/04/19
Ashley P.
Thanks for the response : I tried the same code without the opening and closing square brackets you've used for seperating different cases. Is that also correct? NetBeans didn't show any errors and results were there too10/03/19