This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have an issue in that I need to multiply the PrintWriter output by the user input.
One way I know of doing it would make multiple switch statements to cover every case then simply duplicate the outputStream line to match each case.
I'm not really sure what you mean by this but if it is that you want to output the counter value 'accross' times for each rollNumber then wrap the line of code for the output in an inner for loop which runs from 0 to < accross and take the newline char out of the output format string. Then output a newline char once the inner for loop has completed.
One of the greatest skills all developers need to learn is how to break down problems into their component parts. In this case, the problem was something like:
Print the output the number of times the user input
That can easily be broken into a few things:
do something a certain number of times
get a number from a user
Note that each of these can be done without regard to any of the other two. Sure, eventually you will have to pass the number you get from the user to the piece that does something some number of times...but that's pretty easy.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors