Home Work Problem.
I understand what the program is suppose to do, but I do not understand how to implement it using Link List.

Please help me to understand the problem.

Write a program to perform ariththmetic with integers of unlimited size. You must read data from the input file, input.txt and send output to the file, output.txt.

Each data line has the following format:

number1 operator number 2, where the operator can be one of +, - or *. The operator is preceeded and followed by one or more spaces.

For + and -, Number1 and Number 2 are to be treated as large integers and each must be stored in a link list. Output the given expression and on the next line print the answer. For example,
22222233333333 + 4444455555 =

For *, Number1 is a large integer to be stored in a linked list. Number2 is a small integer whcih can be stored in an int variable. Output the given expression ans on the next line, print the answer for example,
23222222222222 * 7 =
223232323223333
the last line of data contains a zero.

Please help me to under the algorithm in solving this problem

well, it says right there what you need to do. Couldn't be much clearer than what your teacher already told you.
If you don't understand it, tell your teacher and ask him to help you.

Although all you really need to do is look at his moniker to find out what he wants here.

"chetah" when sounded out is the current "slang" sound for cheater. The "street" sound for "er" is, now, almost always "ah".

I am don't think you are quite correct, but good luck all the same.
Peace!

Here is the code I have been working on, help with corrections

Class Node {
    Int num;
    Node next;
}

Public Class Number {
Public static void main (String [] args) {
    Scanner in = new Scanner (new File Reader (“input.txt”)
    PrinterWriter out = new PrintWriter (new FileWriter (“output.txt”)

    Node top, last, np = null;
    top = null;

// Load the input file into the link list 

    int n = in.nextInt()
    While (n! =0) {
    np = new node (num)

    if (top = = null) {
        top = np;
    else {
        last.next = np;
        num = in.nextInt ()
      }
    }

    Curr = top
While (curr !=Null)
String sign = in.next()
If (sign. equals (‘+’) {
    Int sum = prev.next +curr.next
    Curr = curr.next
 //write to output file
Elseif{ 
    If (sign. equals (‘-’) {
    Int difference = prer.next -curr.next
    Curr = curr.next
//write to output file

}
Else{

If (sign. equals (‘*’) {
    Int product = curr.num *curr.next
    Curr = curr.next
//write to output file

}

Did not help much. When I try to read from the input.txt, the in.next() returns only the first number, it does not read the '+" for the number following it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.