Hello all!
I'm new to the forums and I come with a problem. It's been bugging me for the past 2 days and I can't seem to get anywhere with it!
I've been learning
Java through the book "Java in 2 Semesters" which you may be familiar with. It was recommended to me through a gaming community forum and up to this point I was getting on fine with it.
I'm on Chapter 3 Iteration and I'm on to the practical questions at the end of the chapter. It's asking me to track the number of times each option in the program has been chosen and to print this info when option 5 is chosen.
Here is what I've written so far. It allows a user to choose each option and then asks for their choice again. When you choose option 5 it quits. It writes a "1; 2; 3; 4; " at the minute when you choose 5 as this was a vain attempt by me to get it to print out the number of times each case had been chosen.
So far, the program only has a do...while loop to show the menu of options and how to quit the program as I don't know what loop I should be using to get the info returned to me?
What type of loop am I supposed to use and how would it be written in order to return the number of times each option was chosen?:
/* This program is from the "Java in 2 Semesters" book, Chapter 3 Tutorial Exercise 5 (also Practicle Qu3).
This is the program so far. The question asks me to print out the amount of times each option has
been chosen when the program quits by choosing option number 5. I have no idea how to get the program
to track the options and then print them? I'm guessing I have to use a loop but which one and how to
write it I have no idea. The book hasn't given any previous examples as to how to write this and I can't
seem to see any way of doing it. Please help. Cheers!*/
Thanks!