# Thread: problem with illegal start of expression methdo

1. Member Join Date
Dec 2011
Posts
1
Rep Power
0

## problem with illegal start of expression methdo

Hi, im writting a program for rational numbers and im having problem while calling for methods. 2 errors appear:
-error: illegal start of expression
-error: ')' expected
on line 42.
This is my very first post so please tell my if I do something wrong!

Java Code:
```package rational;
import java.util.*;

class Rational {

Scanner scan = new Scanner(System.in);

private int nominator;
private int denominator;

public Rational(int up, int down){
if (down == 0) throw new IllegalArgumentException();
nominator = up;
denominator = down;
}

public Rational(){

nominator = scan.nextInt();
denominator = scan.nextInt();
Rational num = new Rational(nominator, denominator);
System.out.println("This is your rational number:" + num);

}

public Rational (double d){
int pow = 1;
while(d -(int)d != 0){
pow *= 10;
d *= 10;
}
}

public static void main(String[] args){

}

{
nominator = (nominator*arg.denominator)+(arg.nominator*denominator);
denominator = denominator*arg.denominator;

Rational added = new Rational (nominator, denominator);

}

public Rational multiplication(Rational arg)
{
System.out.println ("MULTIPLICATION");
nominator = nominator*arg.nominator;
denominator = denominator*arg.denominator;

Rational multiplied = new Rational (nominator, denominator);

return multiplied;

}

public Rational subtraction(Rational arg)
{
System.out.println ("SUBTRACTION");
nominator = (nominator*arg.denominator)-(arg.nominator*denominator);
denominator = denominator*arg.denominator;

Rational subtracted = new Rational (nominator, denominator);

return subtracted;

}
public Rational division(Rational arg)
{
System.out.println ("DIVISION");
nominator = nominator*arg.denominator;
denominator = denominator*arg.nominator;

Rational divised = new Rational (nominator, denominator);

return divised;

}
}```
Last edited by Norm; 12-15-2011 at 05:27 PM. Reason: added code tags  Reply With Quote

2. ## Re: problem with illegal start of expression methdo

Please post the full text of the error message as written by the compiler. The message has information about the error that you have left out of your post.

Your error could be in passing an argument to a method. You should only code the name of the variable, not its type.  Reply With Quote

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•