Question: Design and implement an abstract data type (ADT) for very large integers. The data type int is limited to the word size of the CPU

Design and implement an abstract data type (ADT) for very large integers. The data type int is limited to the word size of the CPU architecture. You are to develop an ADT that can deal with any sized integer. It should work for 110, 220,500, or more digit integers. Name the ADT largelnt. Requirements: The ADT must work for positive or negative numbers; The ADT has to be implemented using at least 1 and no more than 4 classes; Implement the following methods and operators: o Default constructor largelnt (); that initializes the object to value zero; o Constructor largeInt (int), that initializes the object to the value of the integer parameter; o Read a largelnt: an optional + or - followed by several digits [0-9] ended with a semi colon ";". The input number may span over multiple lines; o Display a largeInt: 60 digits per line maximum; o Add to a largelnt an integer between 0 and 9; o Add two largelnts together; o Subtract from a largelnt an integer between 0 and 9; o Subtract two largeInts. Write a test program that will use the above data structure, use all of the above-mentioned methods and displays the results to demonstrate the required functionality. The interface should be simple, but easy to use by the grader to test your program with different input data.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!