This site requires JavaScript, please enable it in your browser!
Greenfoot back
DAT_RANDOM_DUDE
DAT_RANDOM_DUDE wrote ...

2013/8/27

why dont dis work

DAT_RANDOM_DUDE DAT_RANDOM_DUDE

2013/8/27

#
out.print("Enter an int from 1 to 10: ");
DAT_RANDOM_DUDE DAT_RANDOM_DUDE

2013/8/27

#
the full thing public static void main(String args); Scanner keyboard = new Scanner(system.in); out.print("Enter an int from 1 to 10: "); int inputNumber = keyboard.nextInt(); int randomNumber = new Random().nextInt(10) +1; if (inputNumber == randomNumber) { out.println("*********"); out.println("*you win*"); out.println("*********"); } else { out.println("you lose"); out.println("the random number was"); out.println(randomNumber+"."); } out.println("Thank you for playing."); }
Game/maniac Game/maniac

2013/8/27

#
You have to do system.out not just out
SPower SPower

2013/8/27

#
System.out, not system.out :)
davmac davmac

2013/8/27

#
I guess you mean it doesn't compile? That's because there's a semicolon after the method header and no opening curly bracket. Instead of:
public static void main(String args[]);
    Scanner keyboard = new Scanner(system.in);
    ...
you should have:
public static void main(String args[])
{
    Scanner keyboard = new Scanner(system.in);
    ...
You must remove the semi-colon, and add the curly bracket.
DAT_RANDOM_DUDE DAT_RANDOM_DUDE

2013/9/1

#
diid this and now comes up with reached end of file while parasing? WHAT DOES THIS MEAN SOMEONE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
DAT_RANDOM_DUDE DAT_RANDOM_DUDE

2013/9/1

#
THE CODE NOW public class DA_world extends World { /** * Constructor for objects of class DA_world. * */ public DA_world() { super(600, 400, 1); } public class guessing_game extends Actor { public static void main(String args) { Scanner keyboard = new Scanner(system.in); System.out.print.GetWorld();GetWorld(DA_world); System.out.print("Enter an int from 1 to 10: "); int inputNumber = keyboard.nextInt(); int randomNumber = new Random().nextInt(10) +1; if (inputNumber == randomNumber) { out.println("*********"); out.println("*you win*"); out.println("*********"); } else { out.println("you lose"); out.println("the random number was"); out.println(randomNumber+"."); } out.println("Thank you for playing."); }
SPower SPower

2013/9/1

#
I think you miss a } at the end. And please don't use UPPERCASES since it suggest you're screaming and are angry, and less people may want to help you.
DAT_RANDOM_DUDE DAT_RANDOM_DUDE

2013/9/1

#
ok
DAT_RANDOM_DUDE DAT_RANDOM_DUDE

2013/9/1

#
ty
DAT_RANDOM_DUDE DAT_RANDOM_DUDE

2013/9/1

#
do u know where i might of missed it?
SPower SPower

2013/9/1

#
What do you mean? And by actually looking at it a second time, you miss 2 :)
davmac davmac

2013/9/1

#
If you indent your code properly, it will be obvious where you have '}' missing. Eg:
    public class guessing_game extends Actor
{
    public static void main(String args[]) 
the '{' should be indented at the same level as the line above it, and the next line should be indented more. Also please use 'code' tags when you post code. Write
You need to login to post a reply.