Hello All,
I just started learning java at home .I am getting an error message".java:8: error: cannot find symbol
int randomNum = (int) (Math.Random() *5);"
Could you please help me on the same?
Here is my java code:
class SimpleDotComGame{
public static void main(String [] args){
int numOfGuesses = 0;
GameHelper helper = new GameHelper();
//
SimpleDotCom theDotCom = new SimpleDotCom();
int randomNum = (int) (Math.random() *5);
int [] locations = {randomNum,randomNum+1,randomNum+2};
theDotCom.setLocationCells(locations);
boolean isAlive = true;
while (isAlive == true){
String guess = helper.getUserInput("enter a number");
String result = theDotCom.checkYourself(guess);
numOfGuesses++;
if(result.equals("kill")){
isAlive = false;
System.out.println("You took " + numOfGuesses+ "guesses");
}
}
}
}
rahulamuu 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
rahulamuu 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
rahulamuu 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.