Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

okay You can represent an integer with any number of digits by storing the integer as a sequence of digits in a linked list. A

image text in transcribed
image text in transcribed
okay
You can represent an integer with any number of digits by storing the integer as a sequence of digits in a linked list. A more efficient representation will store a larger integer in each node. Design and implement a class for whole number arithmetic in which a number is implemented as a doubly linked list of integers. Each node will hold an integer value less than or equal to 999. The number represented is the concatenation of the numbers in the nodes. For example, if there are four nodes with the four integers 23,7,999, and O. then this represents the number 23,007,999,000. Note that the number in a node is always considered to be three digits long. If it is not three digits long, then leading zeros are added to make it three digits long. Submitting Your Work Submit your entire directory as a tar.gz archive, online through Moodle. Double check that you have the right file before you submit. Uploading the wrong file will result in a mark of ZERO for the entire assignment. Program Specification: Your class names should match their file names. Use suitable information encapsulation techniques (i.e., data members should be private and a function not changing the object should be constant). Public member functions for the node class should include the following: A default constructor in which the number is 0. o A parametrized constructor in which the user specifies a whole number less than or equal to 999. You may combine the default and parameterized constructor as one. Getter and Setter which return and update the data member. Public member functions for the linked_numbers class should include the following: A parametrized constructor in which the user specifies a whole number less than or equal to 999. o Getters and Setters which return and update their respective data member values. o append_node to add a new node at the end of the list Overload all the following integer operators to work with your linked_numbers class +, , = == In main.cpp, do the following: o Create 2 linked_numbers objects with the names: number1 and number2 Append nodes with appropriate integer values until number1 equals 23,007,909,999, and number2 equals 6,007,002,009 o carry out the following operations on the objects: + - , Additional Program Specification All files (.h and.cpp) should include a comment at the top of the file with your name, and a brief description of what the file is for. All functions should be properly documented in the header file, including PRECONDITION and POSTCONDITIONS (with those words). You do not need to include this in the function implementation as well. Your code should include appropriate comments, identifying variables (if needed) and describing what each section of code is doing All identifiers (function and variable names) should be meaningful. Your code should have proper indentation and spacing. Make your functions minimal -- do not pass in variables that you do not need. Any objects to be passed as parameters should be passed by reference. Make sure to declare object inputs as const where appropriate. Functions which do not modify the object should be const. Expected Output: . number1: 23,007,909,999 number2: 6,007,002,009 number1 + number2: 29,014,912,008 number 1 - number2: 17,000,907,990 number1 == number2: FALSE number1 = number2: TRUE Grading node class linked_numbers class Operator overloading Main program Documentation & formatting 10% 20% 20% 30% 20% *** NOTE: Your code must compile and execute within the laboratory environment. Code that does not compile will result in a mark of ZERO for the entire assignment. ***

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

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago