So I'm writing an application that rolls two six-sided dice, displaying the results after each roll and asking the user if they would like to roll again. It is supposed to show Roll 1, Roll 2, Roll 3, etc, but I am having problems with it showing that based on my counter variable. I have 5 classes created. Below is what I have for code so far.
Not sure about this last one, but the program should have a class called Die that stores the data for each die. This is what I have so far and I'm lost on it.
Wha specific problem are you having? People will be better able to help you if you TellTheDetails(←click).
Also, that's a lot of code, and the vast majority of it is not related to your problem. It will be easier for people to help you (and easier for you to help yourself!) if you write a small program that only shows your problem and doesn't have anything not related to it. An SSCCE(←click).
You are writing too much code at once. Before you ever write a single line of code, you should analyze the problem and come up with all the individual things you need it to do. For example, my first pass at this assignment would be:
1) Generate an integer in the range 1-6
2) compute the sum of two numbers
3) Display a result
4) keep track of the number of rolls
5) ask the user something
6) Get input from a user
7) validate input
8 loop around and do it all again (if needed)
I'd make sure I could do each of the above steps by them selves before trying to combine them. I'd make sure one worked before I considered starting the next.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Whip out those weird instruments of science and probe away! I think it's a tiny ad: