Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use C++ please Create a class UInt16 which will support unsigned integer operations on 16-bit memory. The class must provide implementation of the following operations:

Use C++ pleaseimage text in transcribed

Create a class UInt16 which will support unsigned integer operations on 16-bit memory. The class must provide implementation of the following operations: Default Constructor. Constructor will allocate dynamic memory for the data member and will initial- ize the value to 0. Parameterized Constructor. This constructor will accept an unsigned integer as an argument and set the value of the private data member to the value passed as parameter. The program should perform sanity checks to keep the value in the range. Copy constructor. Copy constructor will perform deep copy as the private data member of the class is allocated dynamically. Copy assignment (=). This function will make sure the assignment of UInt objects is performed correctly. Setter. Create a function set that will accept an unsigned integer as parameter. This function will set the value of the private data member to the given parameter. Check Status. Write a function checkStatus which will return the result of the last arithmetic operation performed by the program. The function will return an enum type value that indicate success or failure. Size. size function will return the size of the operations, in number of bits, supported by the current class. In this case, the function will return 16. Addition. This operation will add two objects of class UInt16. . Subtraction. This operation subtracts two objects of class UInt16. The calling object will be used as a left-hand operand of the minus (-) operator. Multiplication. Similarly, this function will perform multiplication on two objects of UInt16

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

More Books

Students also viewed these Databases questions