posted 13 years ago
take it one step at at time. write AT THE MOST 2-3 lines before you compile. Don't be afraid to write lots of code you know you will throw away (I probably write at least one "System.out.println()" statement that I eventually delete for every line I keep. Follow the directions, on step at a time:
1) One class for the main method
So this tells me the first thing I should do is something like this:
After I wrote that much, I'd compile and run it. THEN I'd start step two:
2) Another class describing the Dice object
Again, I would write EXACTLY THAT and then make sure it compiles. THEN I'd start adding the parts, one at a time. First, the variable to hold the value:
Then compile that. Then add the constructor. Once you have that, you can try and make one in your DiceTester class. When you first make the constructor, you can have it do NOTHING but print "I'm constructing a die!!!" Once THAT works, you can maybe have it do something...
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors