Hi Guys,
I'm in my 8th week of programming. Im trying to create a rock paper scissors game and my program isn't compiling. Can someone tell me what I'm doing wrong
http://pastebin.com/aQ5yrxzy
TFW you are secure in the knowledge the ext generation of programmers is too incompetent to replace you
>>57746514
Line 43 and 44
>>57746514import java.util.Scanner;
import java.util.Random;
public class Rockpaperscissors
{
public static void main (String[] args)
{
String userPlay;
String computerPlay = "";
int computerInt;
System.out.println("Welcome to this Rock/Paper/Scissors game!");
System.out.println("Let's play some!");
Scanner scan = new Scanner(System.in);
System.out.println("What's your play?");
userPlay = scan.next();
//userPlay = userPlay.toUpperCase();
Random generator = new Random();
computerInt = generator.nextInt(3)+1;
if(computerInt == 1)
{
computerPlay = "Rock";
}
if(computerInt == 2)
{
computerPlay = "Paper";
}
if(computerInt == 3)
{
computerPlay = "Scissors";
}
System.out.println("Computer's play is " + computerPlay);
// public boolean evaluateGame;
// evaluateGame = (String userPlay, String computerPlay);
if (userPlay.equals(computerPlay)){
System.out.println("It's a tie");
}
if (userPlay.equalsIgnoreCase("Rock") && computerPlay.equalsIgnoreCase("Scissors")){
System.out.println("You won!");
// return true;
}
if (userPlay.equalsIgnoreCase("Paper") && computerPlay.equalsIgnoreCase("Rock")){
System.out.println("You won");
// return true;
}
if (userPlay.equalsIgnoreCase("Scissors") && computerPlay.equalsIgnoreCase("Paper")){
System.out.println("You won");
// return true;
}
else {
System.out.println("Computer won");
// return false;
}
}
}
}
I don't get it, what did you change in the code??
>>57746704
See >>57746603
Also the return statements are wrong.
>>57746767
so what's a return statement? my TA coded that part for me.
>>57746788
the b8 is off the chart.
m8 fucking delete that java garbage and learn a real language like assembly
>>57746788
Do you see the statements in the lines 52, 56, 60 and 64?
These are return statements.
They should not be there since this is a void method.
>>57746704
>>57746788
This is depressing
>>57746514
i guess this is the level 4chan logged me in as
try using only numbers
>>57746810
what's assembly? is it like javascript?
>>57746826
I deleted those lines but now I get a compile error. plz help
>>57746704import java.util.Scanner;
import java.util.Random;
public class Rockpaperscissors
{
public static void main (String[] args)
{
String userPlay;
String computerPlay = "";
String humanPlay = "NIGGER";
int computerInt;
System.out.println("Welcome to this Rock/Paper/Scissors game!");
System.out.println("Let's play some!");
Scanner scan = new Scanner(System.in);
System.out.println("What's your play?");
userPlay = scan.next();
//userPlay = userPlay.toUpperCase();
Random generator = new Random();
computerInt = generator.nextInt(3)+1;
if(computerInt == 1)
{
computerPlay = "Rock";
}
if(computerInt == 2)
{
computerPlay = "Paper";
}
if(computerInt == 3)
{
computerPlay = "Scissors";
}
System.out.println("Computer's play is " + computerPlay);
if (userPlay.equals(computerPlay)){
System.out.println("It's a tie" + humanPlay);
}
if (userPlay.equalsIgnoreCase("Rock") && computerPlay.equalsIgnoreCase("Scissors")){
System.out.println("You won!" + humanPlay);
}
if (userPlay.equalsIgnoreCase("Paper") && computerPlay.equalsIgnoreCase("Rock")){
System.out.println("You won" + humanPlay);
}
if (userPlay.equalsIgnoreCase("Scissors") && computerPlay.equalsIgnoreCase("Paper")){
System.out.println("You won" + humanPlay);
}
else {
System.out.println("Computer won" + humanPlay);
}
}
}
}
just zip this up and send it to your TA
>>57746927
Wait. I'm pretty sure i'll get a zero if I include NIGGER in there. But when i take it out the app crashes. Should I take out NIGGER with or without the semicolon???
>>57746514
Listen here you dumbass freshman, let me save your parents alot of time and money. Get out of our field. Get out of stem. Run to the English department, or go stand next to the Mexicans at Lowes. If you do not understand this entry level stuff, YOU WILL NOT MAKE IT TO YOUR JUNIOR YEAR
>>57746912
Just copy this code >>57746682
And check if it compiles for you.
Works for me just fine, just make sure the source code file has the same name as the class.
TFW when /g/ bites the b8
>>57747182
i wanna bite ur b8
>>57746810
You meant Python, probably?
I removed all the bullshit. Here ya go opimport java.util.Scanner;
import java.util.Random;
public class Rockpaperscissors
{
public static void main (String[] args)
{
boolean tester = FALSE;
if(tester) {
String userPlay;
String computerPlay = "";
int computerInt;
System.out.println("Welcome to this Rock/Paper/Scissors game!");
System.out.println("Let's play some!");
Scanner scan = new Scanner(System.in);
System.out.println("What's your play?");
userPlay = scan.next();
Random generator = new Random();
computerInt = generator.nextInt(3)+1;
if(computerInt == 1)
{
computerPlay = "Rock";
}
if(computerInt == 2)
{
computerPlay = "Paper";
}
if(computerInt == 3)
{
computerPlay = "Scissors";
}
System.out.println("Computer's play is " + computerPlay);
if (userPlay.equals(computerPlay)){
System.out.println("It's a tie");
}
if (userPlay.equalsIgnoreCase("Rock") && computerPlay.equalsIgnoreCase("Scissors")){
System.out.println("You won!");
}
if (userPlay.equalsIgnoreCase("Paper") && computerPlay.equalsIgnoreCase("Rock")){
System.out.println("You won");
}
if (userPlay.equalsIgnoreCase("Scissors") && computerPlay.equalsIgnoreCase("Paper")){
System.out.println("You won");
}
else {
System.out.println("Computer won");
}
} else {
for (int i; i<1000000; i++){
int myRan;
while (myRan != 3){
Random generators = new Random();
myRan = generators.nextInt(1000)+1;
}
}
tester = TRUE;
}
}
}
>>57746597
>the ext generation
ya blew it
>>57746980
alot -> a lot
maybe you can show him the way to the english department