Homework Assignment Four: Adding Up Integers
In this assignment you will be practicing with loops and arrays.

You are to write a program (call it Add.java) that works like this:

frilled.cs.indiana.edu%javac Add.java
frilled.cs.indiana.edu%java Add
N1: 123
N2: 123

 123 + 
 123
----
0246

frilled.cs.indiana.edu%java Add
N1: 123
N2: 901

 123 + 
 901
----
1024 

frilled.cs.indiana.edu%java Add
N1: 99999999999999999999999999999999999999999999999999999999999999999999
N2: 1

 99999999999999999999999999999999999999999999999999999999999999999999 + 
                                                                    1
---------------------------------------------------------------------
100000000000000000000000000000000000000000000000000000000000000000000

frilled.cs.indiana.edu%java Add
N1: 999999999999999999999999999999999999999999999999999999999999999999999999
N2: 999999999999999999999999999999999999999999999999999999999999999999999990

 999999999999999999999999999999999999999999999999999999999999999999999999 + 
 999999999999999999999999999999999999999999999999999999999999999999999990
-------------------------------------------------------------------------
1999999999999999999999999999999999999999999999999999999999999999999999989

frilled.cs.indiana.edu%
That is,
  1. the program prompts the user for two numbers of any length.

  2. Reads those numbers one by one, as String's.

  3. Turns the Strings into arrays of appropriate size.

  4. Allocates space for an array that will hold the result (thier sum).

  5. Then calculates the result and prints a report.

You are not allowed to use BigIntegers!

Grading scale:

Notice that the program I posted would only get a 9 (which is the lowest A).
Last updated: Jul 5, 2001 by Adrian German for A201