Question: the P4_test data: Microsoft Word - P4_LkdBN.doc 1 / 2 89% Project #4: Large Number Arithmetic with LkdBN Credit 20 pts, Due Friday 3/12 This

 the P4_test data: Microsoft Word - P4_LkdBN.doc 1 / 2 89%Project #4: Large Number Arithmetic with LkdBN Credit 20 pts, Due Friday3/12 This project is to handle big positive numbers of arbitrary size, the P4_test data:

without having to consider the limit of the machine representation. The arbitrary

Microsoft Word - P4_LkdBN.doc 1 / 2 89% Project #4: Large Number Arithmetic with LkdBN Credit 20 pts, Due Friday 3/12 This project is to handle big positive numbers of arbitrary size, without having to consider the limit of the machine representation. The arbitrary bignums have widespread usages, especially in cryptography used in every modern web browser. A linked chain, implemented with pointers and dynamic memory allocation, is a natural and good choice. We obtain storage for digits only when needed. (Note: arbitrary size is not equivalent to infinite; the size is limited by available memory.) To represent a large number like 568743787698370708000902300078 with a linked chain, we could simply create a node for each digit. However, to make more efficient use of storage, we store an integer between 0 and 9999 in each node, which gives the effect of base-10000 numbers. For example, the above number can be represented by a eight-node chain (56, 8743, 7876, 9837, 708, 9, 230, 78), meaning 78*10^0 + 230*10^4 +9*10^8 + 708*10^12 + 9837*10^16 + 7876*10420 + 8743*10^24 + 56*10^28. You will be provided with a data file, P4_testdata.txt, containing several pairs of large numbers. Each number is given on a separate line and there is an empty line between two pairs. You program should read and echo each pair of numbers, add them and multiply them, report their sum and product, and go on to process the next pair until the end of input file. Think your method carefully before you code. You want to design an efficient solution. Ask yourself some questions. In singly-linked chain, does the first node contain the most significant digits or the least significant digits? What is the best way to multiply? Your program should be clearly commented for all classes and member functions. Make sure to include a separate comment block to explain your overall design strategy. Important Note: 1. You'll need at least two classes, namely a node class (either singly-linked Node or doubly- linked Dnode for storing a four-digit integer) and LkdBN (for LinkedBigNum). The classes and main() skeletons are given below. You must use the same identifiers as in these skeletons 2. Please do NOT use template classes/functions in this project. class Node int itm; // item, for storing a four-digit integer Node* nxt; // next, pointer to next Node public: Node(); Node (const int & an Itm); //anItm for an Item Node (const int& an Itm, Node* nn); /n for nextNode ... // other functions Microsoft Word - P4_LkdBN.doc 2 / 2 89% + [ @ 2. Please do NOT use template classes/functions in this project. class Node int itm; // item, for storing a four-digit integer Node* nxt; // next, pointer to next Node public: Node(); Node (const int& anItm); //anItm for an Item Node (const int& an Itm, Node* nn); /n for nextNode . // other functions OR class Dnode! 1 CSC 326 - Spring 2021 int itm; // item, for storing a four-digit integer Dnode* nxt; // next, pointer to next Dnode Dnode* prvi // prev, pointer to previous Dnode public: Dnode(); Dnode (const inte anItm); Dnode (const int& anItm, Dnode* nn, Dnode* pn); // pn for prevNode ..// other functions }; AND class LkdBN // Node* head; // if you choose to use singly-linked chain Dnode* head; // if you choose to use doubly-linked chain Dnode* tail; // if you choose to use doubly-linked chain int ic; // item count, use it or not, up to you public: LkdBN(); LkdBN (const LkdBN& aBN); //copy ctor LkdBN (const string& str); // ctor converts a string to a LkdBN - LKBN(); ... // other functions Microsoft Word - P4_LkdBN.doc 2 / 2 89% + 10 Didale Dnode (const int& an Itm); Dnode (const int& anitm, Dnode* nn, Dnode* pn); // pn for prevNode ..// other functions }; AND class LkdBN { // Node* head; // if you choose to use singly-linked chain Dnode* head; // if you choose to use doubly-linked chain Dnode* tail; // if you choose to use doubly-linked chain int ic; // item count, use it or not, up to you public: LkdBN(); LkdBN (const LkdBN& aBN); //copy ctor LkdBN (const string& str); // ctor converts a string to a LkdBN - LKBN(); ...// other functions //operator overloading friend ostream& operator

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!