I know that I am making it incorrectly as you cannot have 2 different values for an int What is a different method I could use to do what I'm trying to achieve?
O dont understand your code at all. Are 'result' and 'one' variables (or constants) declared somewbere else? What exavtly are you trying to accomplish?
Sorry, part of the reason you don't understand it is that I altered some of it but forgot to alter the rest when I pasted it onto here. My fault sorry.
Here is the revised code with a bit extra
int total= 0;
int result= 1 + (int)(Math.random()*6);
if (result== 1){
int total= total +1; } show.setText(String.valueOf(total));
}
'Result' is the value of the equation
int result = 1 + (int)(Math.random()*6);
And 'Total' is supposed to be a running total that increases by 1 each time 'Result' equals 1. My aim is to have several equations and create a total of the number of times it equals 1(or any othe number). Creating this total is what I'm not sure on. I haven't declared it anywhere else in the code.
Thank you and my apologies for messing up the first post
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.