Create a class called Huge that will allow the creation and handling of large non-negative integers (up to 1000 digits).
$8-13 USD
Fechado
Publicado há aproximadamente 22 anos
$8-13 USD
Pago na entrega
You are to create a class called Huge that will allow the creation and handling of large non-negative integers (up to 1000 digits). There should be a constructor that expects a regular integer parameter (default value of 0). If a negative parameter is provided, set the value of the object to zero. There should be a second constructor that expects a string (array of char) as a parameter. If the string provided is empty or contains any characters other than ‘0’ through ‘9’, set the value of the object to zero. There should be a member function input that will allow the entry of a Huge number into an existing object. If any of the characters input is not ‘0’ through ‘9’, set the object to zero. There should be a member function add that has one parameter of type Huge. The function add should calculate the sum of the invoking object with the Huge parameter and return a Huge object that represents that sum (add should not change either the invoking object or the parameter). Should the sum cause a carry into the 1001th digit, discard that carry. There should also be a member function multiply that calculates the product of the invoking object and its Huge parameter, returning a Huge object that represents that product (multiply should not change either the invoking object or the parameter). Any digits beyond the 1000th digit in the product should be discarded. Finally, there should be a display member function that will allow the output of Huge objects. I am providing the main program. It is called [login to view URL] and may be copied from my home directory on the CS machine. Assuming you are logged into the CS machine, the command “cp ~leach/[login to view URL] .?? will create a file by that same name under your current working directory. You can then use SSH (or cslogon) to get that file to a PC. Your class declaration and implementation files must work with my demo program (don’t change my program to make your code work!). Your output should look IDENTICAL to mine. Most questions about the required behavior of the class can be determined by carefully examining my demo program and the sample execution that are given below. You should submit two files in the standard way: huge.h and [login to view URL]… do not submit the [login to view URL] file.
## Deliverables
Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. Complete copyrights to all work purchased.
## Platform
Must be done in visual c++.
## Deadline information
must be done by 3/3/2002