Comp 212 Project 2
Accurate Floating-Point Sum
Due April 3, 2000 at 10:00 AM
The accuracy of floating-point arithmetic is limited by the fact that floating-point numbers are implemented using a finite number of digits. Internally, the implementation of floating-point numbers is similar to a number written in scientific notation, for example, -5.678 * 109. In other words, the sign (-), the mantissa (5.678), and the exponent are stored as separate fields, and the number of digits in the mantissa and exponent is fixed.
If we add a very large number with a very small number, our result may (incorrectly) be
just the larger number. The reason is that to add the numbers we must,
To avoid this problem, one possible way to sum a list of positive floating-point numbers is as follows.
Your program should accept a list of (possibly negative) floating-point numbers as
input through the standard input stream, with one floating-point number per line. It
should recognize the end of the list when this stream reports end-of-file (
It should then compute and print the sum to the standard output stream.
Your priority queue must be based upon a heap. You should apply the ``Object'' Adapter Pattern to construct a priority queue from a heap. Your ordered container must be based upon the circular list presented in class. Again, you should apply the ``Object'' Adapter Pattern. Furthermore, the ordered container's methods should be implemented as Visitors to the circular list.
Code samples are provided for your convenience!
The project is broken up into two milestones. Each milestone is to be submitted electronically. You can use slack days on this project. You are given a total of five slack days for the whole semester. Specific submission instructions will be posted on the Comp212 web page. The complete milestone set should contain the following:
Milestone #1: due March 27, at 10:00 AM - the priority queue and ordered container classes as well as testing code for these classes. 40% of the project grade
Milestone #2: due April 3, at 10:00 AM - the complete program. 60% of the project grade