aspose file tools
The moose likes Beginning Java and the fly likes Looping a switch statement? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Looping a switch statement?" Watch "Looping a switch statement?" New topic
Author

Looping a switch statement?

Albert Richards
Greenhorn

Joined: Apr 28, 2010
Posts: 7
Hi everyone,

I have a system where a user can order some predefined items. To do this, I have been using a switch statement, e.g:



However, once i've reached the end of the individual cases, I would like them to repeat, so the user could buy more than one item at once, and have this added to an array list. I think I have the array worked out, but the loop is proving problematic. I understand that the code below is one way I can do it, but I don't know how to increase the counter so the statement can loop properly.

Can anyone please help? Thanks



David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You *are* increasing the counter: i++.
Moguluri Ravi Kiran
Ranch Hand

Joined: Apr 16, 2010
Posts: 60

this logic may help you..


 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Looping a switch statement?
 
Similar Threads
User Defined Package Doubts
More than a sorting with dupplicate elimination
static method not running
[HELP]Trying to make a decision cmd adventure! How to branch decisions? NEED HELP AGAIN :S! NOT done
Help in writing a better program for Vampire numbers