Question
In c# In this program you will design and implement a class that uses lists to implement a new data type which will be referred
In c# In this program you will design and implement a class that uses lists to implement a new data type which will be referred to as InfInt - integers which can hold extremely large integer values, much larger than c# int's (32 bits) or even c# long's (64 bits). C# ints can contain values between -2,147,483,648 and 2,147,483,647 while c# longs can hold values between - 9,223,372,036,854,775,808 and 9,223,372,036,854,775,807. The new data type which you will create will be able to deal with integer values which can be much larger than c# longs. Your program should implement class InfInt using a list in which each node contains a data value of type int which represents a single decimal digit. This data value will represent the multiplier of one power of ten in the number being represented. Thus the decimal number: 345 = 3*100 + 4*10 + 1 would be represented by a three node linked list in which one node contains a 5, one node contains a 4 and one node contains a 3. The place or power of ten represented by each node is understood from the order of the nodes. Use the c# List class to hold your InfInt objects in your driver program you would create the List of InfInt objects with the following code: var A = new List; Your program should implement the operations of addition, subtraction, and multiplication for the InfInt data type by creating plus, minus and times methods. Your task of writing these methods will be made much easier if you have your InfInt class implement the Comparable interface and start by writing compareTo() which can then be used in plus(), minus() and times(). You will also need to learn how to open a txt file and parse the data in c# a good reference for this is located at https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/filesystem/how-to-read-from-a-text-file A test file will be posted to blackboard to aid you in testing your program. The official name for the data file is infint.txt. The data file contains triplets of two decimal integer numbers (each on a separate line) and an arithmetic operation to be applied to the numbers on the third line. Your program should be capable of reading one infinite integer into an InfInt object named A and reading the other infinite integer into an InfInt object named B and then performing the arithmetic operation and printing the result with a statement similar to: Console.WriteLine($"A + B = {A.plus(B)}); Note that negative numbers are possible either given explicitly or as a calculated result. Also, output should be written to the monitor. Sample Input: 1111111111111 98765432198765432 + 12345678901123 -100 * 86543123445 112 - Sample Output: (the arithmetic may not be correct) (write your output to the monitor) 1111111111111 + 98765432198765432 = 98766543309876543 12345678901123 * -100 = -1234567890112300 86543123445 - 112 = 86543123333
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started