Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone please help with this? Objectives: Develop, implement, and use an Abstract Data Type (ADT) with the class construct in C++. Problem: The data

Can someone please help with this?

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Objectives: Develop, implement, and use an Abstract Data Type (ADT) with the class construct in C++. Problem: The data type int in C++ is limited to the word size of the CPU architecture (e.g., 32 or 64 bit). Therefore you can only work with signed integers up to 2,147,483,647 (in the case of signed 32 bit). Unsigned 32 bit is still only 10 digits. Maxint for 64 is somewhat larger at 9,223,372,036,854,775,807 but still only 19 digits. Clearly, this causes difficulties for working with very large integer values (say 100 digits). Your job is to develop an ADT (called bigint) that can take any size postive integer. It will work for 100, 200, 500, etc. digit integers. Representation is a key issue for this assignment. We recommend an array of integers, with each element representing one single digit (0 to 9) of the big number. One could use an array of char, but the memory savings is pretty minimal. Placing the values in the array is the interesting part. The nave representation makes storing the bigint easy but makes the operations (add and multiply) very difficult to implement. A slightly more clever representation makes storing the big number a little bit harder but makes implementing the operations way easier. Arrays are typically drawn to be read left to right with the 0 element on the left and the largest on the right. However, arrays are a completely made up concept and are not physical in nature. So you can draw them and think about them anyway you want. For this problem having the right side as the 0 element and the left side as the largest makes much more sense. Take the example of the number 299,793. We show how it is stored in the array below. The 3 is in the one's position, the 9 in the 10's position and so on. This neatly corresponds to the index of the array. The addition and multiple algorithms given below use this representation. bigint 1 0 Place: 10^n's.. 10^7's 10^6's 10^5's 10000's 1000's 100's 10's 1's Index: 3 9 3 Value: Requirements: www.cs.kent.edu/-xlan/2020springcs23001/proj1.html 1/4 1/13/2020 CS23001 Project 1 In your svn folder, name the folder for this project bigint. There is a makefile and test cases provided for you in the svn/shared/project1/ folder in svn. Your program must compile and run on the department's system (wasp or honet) using the provided Makefile. You must use the class construct to implement your ADT. The ADT bigint need only work for positive integers. Use a global constant for the capacity of the bigint that is, a fixed sized array. using namespace std; is stricly forbiden. As are any global using statements. You can NOT use a pre-defined library or built in class (such as std::vector or std::string) to solve this problem. Use a standard array to solve the problem. You also do not need to solve any part of this problem. 2. Milestone 1 - 30 pts o Implementation: Develop .hpp and.cpp files to implement your ADT. - The capacity of the bigint must be specified by a global constant CAPACITY, use: const int CAPACITY = 400; - A default constructor to initialize a bigint to zero. - A constructor to initialize a bigint to an int value you provide [0, maxint]. Example: bigint(128). A constructor to initialize a bigint to a const char[] you provide. You can assume what is provided is a valid bigint. Example: bigint("299793"). Develop a method called debugPrint that will be helpful for debugging your bigint. se a method defintition of void debugPrint(std::ostream&) const; It simply prints out every element of your bigint array starting from the highend (e.g., capacity-1) of the bigint to zero. Printing a "|" between each value will also be pretting helpful to help with debugging. - Overload output operator to solve any part of this problem. You must have a separate specification file (.hpp ), implementation file (.cpp), and main file. You must do any necessary eror checking. Your program will be graded on programming and commenting style as well as the implementation of your ADT. Include all source code files in svn. See the grading policy for other requirements. Objectives: Develop, implement, and use an Abstract Data Type (ADT) with the class construct in C++. Problem: The data type int in C++ is limited to the word size of the CPU architecture (e.g., 32 or 64 bit). Therefore you can only work with signed integers up to 2,147,483,647 (in the case of signed 32 bit). Unsigned 32 bit is still only 10 digits. Maxint for 64 is somewhat larger at 9,223,372,036,854,775,807 but still only 19 digits. Clearly, this causes difficulties for working with very large integer values (say 100 digits). Your job is to develop an ADT (called bigint) that can take any size postive integer. It will work for 100, 200, 500, etc. digit integers. Representation is a key issue for this assignment. We recommend an array of integers, with each element representing one single digit (0 to 9) of the big number. One could use an array of char, but the memory savings is pretty minimal. Placing the values in the array is the interesting part. The nave representation makes storing the bigint easy but makes the operations (add and multiply) very difficult to implement. A slightly more clever representation makes storing the big number a little bit harder but makes implementing the operations way easier. Arrays are typically drawn to be read left to right with the 0 element on the left and the largest on the right. However, arrays are a completely made up concept and are not physical in nature. So you can draw them and think about them anyway you want. For this problem having the right side as the 0 element and the left side as the largest makes much more sense. Take the example of the number 299,793. We show how it is stored in the array below. The 3 is in the one's position, the 9 in the 10's position and so on. This neatly corresponds to the index of the array. The addition and multiple algorithms given below use this representation. bigint 1 0 Place: 10^n's.. 10^7's 10^6's 10^5's 10000's 1000's 100's 10's 1's Index: 3 9 3 Value: Requirements: www.cs.kent.edu/-xlan/2020springcs23001/proj1.html 1/4 1/13/2020 CS23001 Project 1 In your svn folder, name the folder for this project bigint. There is a makefile and test cases provided for you in the svn/shared/project1/ folder in svn. Your program must compile and run on the department's system (wasp or honet) using the provided Makefile. You must use the class construct to implement your ADT. The ADT bigint need only work for positive integers. Use a global constant for the capacity of the bigint that is, a fixed sized array. using namespace std; is stricly forbiden. As are any global using statements. You can NOT use a pre-defined library or built in class (such as std::vector or std::string) to solve this problem. Use a standard array to solve the problem. You also do not need to solve any part of this problem. 2. Milestone 1 - 30 pts o Implementation: Develop .hpp and.cpp files to implement your ADT. - The capacity of the bigint must be specified by a global constant CAPACITY, use: const int CAPACITY = 400; - A default constructor to initialize a bigint to zero. - A constructor to initialize a bigint to an int value you provide [0, maxint]. Example: bigint(128). A constructor to initialize a bigint to a const char[] you provide. You can assume what is provided is a valid bigint. Example: bigint("299793"). Develop a method called debugPrint that will be helpful for debugging your bigint. se a method defintition of void debugPrint(std::ostream&) const; It simply prints out every element of your bigint array starting from the highend (e.g., capacity-1) of the bigint to zero. Printing a "|" between each value will also be pretting helpful to help with debugging. - Overload output operator to solve any part of this problem. You must have a separate specification file (.hpp ), implementation file (.cpp), and main file. You must do any necessary eror checking. Your program will be graded on programming and commenting style as well as the implementation of your ADT. Include all source code files in svn. See the grading policy for other requirements

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions

Question

Compute the derivative f(x)=(x-a)(x-b)

Answered: 1 week ago