# Thread: can anyone explain this question for me?

1. ## can anyone explain this question for me?

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

+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.

2. Well, what do you not understand?

3. He understands cross-posting, that's for sure.

4. ok some part that i don't understand is making the 'skeleton' of the program and differentiation of signed and unsigned ..
i didn't learnt that yet and still the lecturer asks for this in my assignment

5. So how about you ask the lecturer about it? If the lecturer is assigning problems related to unsigned/signed overflow, don't you think you should get that information from him/her?