Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java cps350 We are going to implement a Java class for big integers using singly linked list. The main idea of the data representation is

java cps350
image text in transcribed
image text in transcribed
We are going to implement a Java class for big integers using singly linked list. The main idea of the data representation is illustrated by the following figure. The above singly linked list represents the number 2415763190, such that the head node keeps the sign, and the rest of the nodes keeps the digits in a reverse order. That is, the 2 nd node keeps the last 4 digits, the 3rd one keeps the digits in the positions of 5 to 8 , and so on. As another example, the number 274647392927419374643 is represented as You may use the following template for the Java classes: class MyBigInteger \{ IntegerNode sign; // reference to the sign node ? class IntegerNode \{ int digits; // 4 digits in the current node higher positions ? Programming Tasks: 1. (5 points) Writing a constructor for the Java class MyBigInteger: MyBigInteger (long n ) It transforms the given long integer to our singly linked list representation. 2. (5 points) Writing another constructor for the Java class MyBigInteger: MyBigInteger (String n ) It transforms the given string-represented integer to our singly linked list representation. 3. (5 points) Overload the member function tostring in the Java class MyBigInteger such that it returns a reference of the string representation of the integer number, and can be used for displaying the number. 4. (5 points) Overload the member function equals in the Java class MyBigInteger such that you are able to check the equivalence of two big integers represented by singly linked lists. You are allowed to add auxiliary or helper functions, however please only do so if it is necessary. Some of the programming tasks can be done easily using recursion. The score of your implementation will be determined by the percentage of the passed test cases which are unknown to you

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

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago