> basically the only thing i been able to think so far is.
> if(num<10)
[quoted text clipped - 31 lines]
>
> > Thanks in advance.- 隐藏被引用文字 -- 显示引用的文字 -
> 23/10= 2
> 23-10*2=3
23 % 10 == 3
To the OP:
These are fundamental language elements. By the time you get to a "final year
project" you really should already know about the integer division and
remainder operators.
Check out the Sun Java tutorials and also Bruce Eckel's book, _Thinking in
Java_, which is available in a free online edition.
> System.out.println.(num)
This statement will not compile.
Try doing things the "Shanahan way": write a skeleton of the overall Java
program that compiles correctly. You can even go so far as to just put in the
raw class definition and nothing else:
package finalproject;
public class DigitAdder
{
}
as a first step. Once that compiles correctly, expand it to:
package finalproject;
public class DigitAdder
{
public int digitAdd( int num )
{
return 0;
}
}
Once that works, then add a main() method that instantiates a DigitAdder and
invokes the object's digitAdd() method.
Then revise digitAdd() to return correct results.
Continue onward from there.
- Lew