hi i got my second assigment here for oop in c++.
but i don't understand clearly.
can anyone explain it to me?
ASSIGNMENT 2
INTRODUCTION TO CLASS [15 marks]
Objective: 1.Learn how to write class which uses dynamic memory allocation
2. Learn how to invoke member function/send message to object
There are several ways to represent whole numbers in digital computer which are equivalent to each other. Namely,
a. Signed
b. Unsigned
c. Two complement.
Numbers are represented as binary in computer system. In this assignment you will write program about how computer treat numbers that you see as decimal integers. Particularly, we are considering unsigned representation/format.
You have to create a class named UINT that represents (unsigned) binary representation of integer. For example, the (unsigned) binary representation of 35 is 00100011 (8-bit word) or 00000000 00100011 (16-bit word).
It has int pointer type data member to store the binary digits that represent an integer number and int data member to store the length of the array of int pointer.
A constructor with int argument as initial value to the UINT object. For example, you can declare
UINT t(456);
A member function int toint() that converts the binary into int.
A member function UINT add(UINT) that adds to UINT objects(note: be careful of overflow error).
A member function void print1() that prints the binary representation of an integer number (the content of the pointer). It prints 00100011 instead of 35.
A member function void print2() that prints the decimal value of the variable. It prints 35 instead of 00100011.
A destructor that delete the pointer when a UINT object exits its scope.
UINT
-len : int
-*bin :int
+<<constructor>> UINT(:int,int=16 )
+toint() : int
+add(:UINT) :UINT
+print1()
+print2()
+~UINT
*int type variables can be replaced with short.
Fig. 1. UML Diagram of class UINT
Write main function to test the supposed capability of your program and attached the screenshot of the results on your report. For, example if you have mechanism that prevent overflow error, demonstrate it in your main function.