CS 5253	 Workshop I					Semester A 2002-2003

Assignment 2:  Design and Implementation of a new data type (INT64)

Due date:   Week 9/10 Monday

Most of the C++ compilers support the following two data types for nonnegative integer data representation: 

•	unsigned int	: 16 bits, ranges from 0 to 65535
•	unsigned long  	: 32 bits, ranges from 0 to 4294967296

These representations do not have enough bits for applications that need to deal with very large values of integers. In this assignment, you are required to use C++ to implement a new data type named ‘INT64’, which supports integers ranging from 0 to 264 – 1.

You need to implement a constructor function for this class. For example, when a variable is declared like this:

	INT64 x;

x is automatically assigned an initial value of 0.

This new data type needs to support addition (+), subtraction (–), multiplication (*) and division (/) between two INT64 variables. If an overflow or an underflow occurs, display an error message and terminate the program.

To simplify the problem, arithmetic with other data types (e.g. int and long) is not required. For example, you do not need to consider the situation of adding an integer to an INT64 variable. 

Furthermore, the input (>>) and the output (<<) operators should be supported. For simplicity, your program is only required to support hexadecimal format. 

Your program should prompt the user to enter two INT64 numbers in hexadecimal format. Let them be x and y. Then the result of x+y, x-y, and x*y should be displayed on the screen.

In this assignment, you are required to do the following:

1.	Submit a Report
Your report should describe the design specifications, principles and implementations. Point out the techniques you use to improve the efficiency of your program, if any. In addition, a test plan with sufficient test cases is needed to validate the functionality of the prototype. 

2.	Do a Demonstration
The accuracy of your program will be tested.