Honestly, your code still needs a bit of work to make it clearer and easier to follow. As I mentioned in another thread, you should write code in such a way that it reads the way it is intended to work. Each method should have a single responsibility and consistent level of abstraction and detail. Assign methods names that reflect what they actually do. Your rollDice() method does not actually just roll the dice; it does almost everything.
My first-cut implementation of rollDice() would probably be something like:
But then again, this code is very procedural. If I really wanted OO code, I might try something like:
Notice that these first methods do not have much detail but they give you a high-level view of what happens in the program. If you need more detail, you would drill down to other methods. Those methods would have a lower level of abstraction and more detail. The trick is getting the right balance of detail and abstraction.
Thanks im gonna give it another bash, i think my problem is we havnt started OO programming yet, the ways i ave used are the ways we have been shown so far. Only been in java for 2-3 months. My problem is, linking methods, like you have there methods called in other methods.
Thanks for the advice.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com