Here is the assignment:

Overview

Write a program that reads a list of many-digit integers from a file, adds them together, and

writes the result to an output file.

You may not make any assumptions about the maximum number of digits that a number will

have. A reasonable linked-list implementation of the solution should run successfully with

the instructor’s test data on the instructor’s machine.

The format of the numbers will be the same as for valid real numbers in Java. You may

assume that scientific notation will not be used for the input (and should not be used for the

output).

Input

Your input will be in a text file containing several numbers, one to a line. An example of

what the input might look like is:

11111111111111111111111111111111111111111111111111 0

-11111111111111111111111111111111111111111111111111 1

22222222222222222222222222222222222222222222222222 22

33333333333333333333333333333333333333333333333333 333

-4

Output

Your output will be to another file, and will echo the input and give the result. Output for

the preceding input example might look like:

The sum of

11111111111111111111111111111111111111111111111111 0

+ -11111111111111111111111111111111111111111111111111 1

+ 22222222222222222222222222222222222222222222222222 22

+ 33333333333333333333333333333333333333333333333333 333

+ -4

is

35777777777777777777777777777777777777777777777777 772

Processing

The only processing requirement I am placing on this programming project is that it use a

linked list to store the numbers (and not BigInteger objects).

There is one additional major consideration in building your long number, though: the sign.

Adding negative numbers means doing subtraction and allowing for negative results.

One other suggestion I would make is that your program deal with each input number and

calculate a subtotal before processing the next number. Since you don’t know ahead of

time how many numbers you will need to process, storing them all is probably more difficult

than processing each as it is read from the input file.

Code :

import java.io.File; import java.util.Scanner; import java.util.*; import java.util.LinkedList; public class Homework3 { public static void main(String[] args) throws Exception{ File file = new File("linklist.txt"); Scanner input = new Scanner(file); LinkedList numbers = new LinkedList(); System.out.println("The sum of "); while (input.hasNext()) { String num = input.nextLine(); numbers.add(num); System.out.println(num); //Display ea number } System.out.println("is"); System.out.println(""); //Right here is where I need the code help!!!!!!!!!!!!!!!!!!!!! //Add the list items together one number at a time. Find out how long the string of each one is. input.close(); } }

I need help in finding out how to add these numbers in a string together