public class slots
{
public static void main(String[]args)
{
public String pull() {
int rand = (int)(Math.random()*3+1);
if(rand == 1)
return "cherries";
else if(rand == 2)
return "bar";
else
return "7";
}
string1 = pull();
string2 = pull();
string3 = pull();
}
}
class TripleString
{
public static final int MAX_LEN = 20;
private String string1;
private String string2;
private String string3;
TripleString()
{
string1 ="";
string2 ="";
string3 ="";
}
public void setTripleString (String str1, String str2, String str3)
{
string1 = str1;
string2 = str2;
string3 = str3;
}
public String getstring1()
{
return string1;
}
public String getstring2()
{
return string2;
}
public String getstring3()
{
return string3;
}
private boolean vaildString( String str )
{
if (str.length() >0 && str.length() <= MAX_LEN)
{
return true;
}
else
{
return false;
}
}
}
I currently have this code and am trying to create a slot machine that will randomly return these values but there is a syntax error on string pull() that im not sure how to fix. Does anyone know how to make this work?