Hello,
I am trying to create a dice rolling program. I want users to be able to enter number of dice to roll, then type of dice to roll i.e. d6, d20, etc. I need the variable for the die roll result to be added up and displayed to the user in a text box. This is the code I have to do it:
public void doDiceStuff()
{
dice = new DieRoller();
String input_1 = textIn_1.getText();
String input_2 = textIn_2.getText();
int qty = Integer.parseInt(input_1);
int dieType = Integer.parseInt(input_2);
for (i = 0; i <= qty; i++) {
int newValue = newValue + dice.rollIt2(dieType);
}
textOut_0.setText("" + newValue);
}
I get an error on the last line: "Cannot find symbol - variable newValue"
Thank you for your help!
~Howard