Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


can someone help me with java?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
NumbLove
Advanced Cheater
Reputation: 0

Joined: 20 Feb 2007
Posts: 78

PostPosted: Mon Oct 01, 2007 1:23 pm    Post subject: can someone help me with java? Reply with quote

this is what i have so far
Quote:

import TerminalIO.KeyboardReader;
public class lol {
public static void main (String [] args) {
KeyboardReader reader = new KeyboardReader();


System.out.println("numerator is what?");
int numerator = reader.readchar();

int denominator = reader.readchar();

int total = numerator/denominator;
int remainder = numerator % denominator;
System.out.println("The answer is " + total + " r" + remainder +".");
}

}

but it does not compile...it is trying to take two input int values and then give an answer and remainder. can someone tell me what i have done wrong

_________________
working on it..


void wrote:
happyh wrote:

3. Will not get banned, because i use private hax and packet edit.

LOLOLOLOL
LOLOLOLOL
LOLOLOLOL
LOLOLOLOL
LOLOLOLOL
LOLOLOLOL
LOLOLOLOL
LOLOLOLOL
LOLOLOLOL
LOLOLOLOL
LOLOLOLOL
LOLOLOLOL
LOLOLOLOL

Back to top
View user's profile Send private message AIM Address
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Mon Oct 01, 2007 1:38 pm    Post subject: Reply with quote

take away 1 } at the end

why dont you give us compile errors?

_________________
Back to top
View user's profile Send private message
NumbLove
Advanced Cheater
Reputation: 0

Joined: 20 Feb 2007
Posts: 78

PostPosted: Mon Oct 01, 2007 1:52 pm    Post subject: Reply with quote

Quote:


----jGRASP exec: javac -g C:\Documents and Settings\David\Desktop\JAVA\lol.java

lol.java:8: cannot find symbol
symbol : method readchar()
location: class TerminalIO.KeyboardReader
int numerator = reader.readchar();
^
lol.java:10: cannot find symbol
symbol : method readchar()
location: class TerminalIO.KeyboardReader
int denominator = reader.readchar();
^
2 errors

----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.

the 2nd } is needed but thanks for the idea

_________________
working on it..


void wrote:
happyh wrote:

3. Will not get banned, because i use private hax and packet edit.

LOLOLOLOL
LOLOLOLOL
LOLOLOLOL
LOLOLOLOL
LOLOLOLOL
LOLOLOLOL
LOLOLOLOL
LOLOLOLOL
LOLOLOLOL
LOLOLOLOL
LOLOLOLOL
LOLOLOLOL
LOLOLOLOL

Back to top
View user's profile Send private message AIM Address
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Mon Oct 01, 2007 2:27 pm    Post subject: Reply with quote

its not readchar()
its ReadChar()

java is case sensitive Very Happy

_________________
Back to top
View user's profile Send private message
DeltaFlyer
Grandmaster Cheater
Reputation: 0

Joined: 22 Jul 2006
Posts: 666

PostPosted: Mon Oct 01, 2007 4:57 pm    Post subject: Reply with quote

By conventions, Java methods begin with lower case. So it's not ReadChar, but rather readChar.

To OP:
Java classes have, by convention, the first letter of its name capitalized.
Also, KeyboardReader is not a standard Java class. Input stream reader or the Scanner class introduced in Java 5 should be used.

Also, the method readChar reads, as its name suggests, a character. You should be trying to read in an integer.

Here's your code fixed:

Code:
import TerminalIO.KeyboardReader;
public class Lol
{
    public static void main (String[] args)
    {
        KeyboardReader reader = new KeyboardReader ();


        System.out.println ("numerator is what?");
        int numerator = reader.readInt ();

        int denominator = reader.readInt ();

        int total = numerator / denominator;
        int remainder = numerator % denominator;
        System.out.println ("The answer is " + total + " r" + remainder + ".");
    }
}


Here's a the fixed code using input stream:

Code:
import java.io.*;
public class lol
{
    public static void main (String[] args)
    {
        try
        {
            BufferedReader in = new BufferedReader (
                    new InputStreamReader (System.in));

            System.out.println ("numerator is what?");
            int numerator = Integer.parseInt (in.readLine ());

            int denominator = Integer.parseInt (in.readLine ());

            int total = numerator / denominator;
            int remainder = numerator % denominator;
            System.out.println ("The answer is " + total + " r" + remainder + ".");
        }
        catch (IOException ioe)
        {
            ioe.printStackTrace ();
        }
    }
}


Here is the fixed code using Scanner:
Code:
import java.util.*;
public class lol
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner (System.in);

        System.out.println ("numerator is what?");
        int numerator = sc.nextInt ();

        int denominator = sc.nextInt ();

        int total = numerator / denominator;
        int remainder = numerator % denominator;
        System.out.println ("The answer is " + total + " r" + remainder + ".");
    }
}

_________________

Wow.... still working at 827... what's INCA thinking?
zomg l33t hax at this place (IE only). Over 150 people have used it, what are YOU waiting for?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites