First Summer 2004


Assignment Ten
Due date
Wednesday June 9 midnight (11:59pm)

Late policy
Try to turn everything on time, no solutions will be accepted late.

Work policy
Working in groups is encouraged but please turn in your own version of the assignment. Also, please make sure you read, understand, and comply with the Computer Science Department's Statement on Academic Integrity before turning in your assignment.

Task
In this assignment you will be practicing with loops and arrays.

Write a program to solve the following problem: Adding Up Integers

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 90 (which is the lowest A).
Grading
Feedback will be provided within a few days, grades will be posted on-line.