0
Rock, paper, error ( Re-upload)
( Re upload because people couldnât see all my code) I'm making a game for class but there's an error. Whenever I put in something like "paper rock" it will give me the answer I want: " Rock wins! :D" along with a bunch of other answered I didn't want. Sample input: scissors rock Sample output: "Scissors Wins!" "Rock Wins!" "Paper Wins!" etc. What can I do to make it stop doing that and only print out the RIGHT answer? https://code.sololearn.com/cj8nVyNNM9w7/?ref=app (Here is the code here)
6 Answers
+ 1
Err3c code doesn't works , can you correct it pls!
+ 1
The code is now working
+ 1
I put the numbers in to compare them like 4<5 because i thought it would work. ( It worked in my head so thats why I used the numbers to compare)
And about the random generator, that was from my previous times using the code. I never got rid of it-( though i probably should)
+ 1
Abhay when you input those two together it creates an output. But now as I'm typing this out, I'm realizing, it's not in my code....... (oops, sorry) I guess, it was another error. I'm very sorry for the confusion
0
Err3c Ty!
Can you explain in brief what are those 1 , 2 , 3 , 10,20 values doing there ?
Also what the following line is suppose to do ?
if (rock==rock) { System.out.println("tie :p");
}
And you never used generator . According to you input should be scissors , rock or paper but then what are those integer values doing in the program ?
0
Err3c how does "rock paper" gives an answer as "Rock wins" ?