[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Please Help me with my Java

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 22
Thread images: 4

File: image.jpg (118KB, 1280x720px) Image search: [Google]
image.jpg
118KB, 1280x720px
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
>>
File: cc3.png (821KB, 865x807px) Image search: [Google]
cc3.png
821KB, 865x807px
TFW you are secure in the knowledge the ext generation of programmers is too incompetent to replace you
>>
>>57746514
Line 43 and 44
>>
>>57746514
import 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
>>
>>57746704
import 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???
>>
File: tumblr_lmhakwC9Oi1qcs2n5o1_400.png (305KB, 400x400px) Image search: [Google]
tumblr_lmhakwC9Oi1qcs2n5o1_400.png
305KB, 400x400px
>>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 op

import 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
Thread posts: 22
Thread images: 4


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.