Sunday, February 26, 2017

OOP Questions for Practice

1. You have to make a class of “DECIMAL” that store the data “44.78” separately i.e. 44 in one variable and

78 in another variable.

And make the following functions.

 Constructors

 Getter / Setter

 Input / Output

 Sum (that sum two numbers)

 Subtract (that subtract two numbers)

 Multiply (that multiply two numbers)

 Divide (that divide two numbers)

2. Make a class of “phoneNumber” that contains

I.e. your home phone number is (042)-(35978)- (5294)

That have [(042) area code], [(35978) exchange number] and [(5294) your number]

You have to declare above all data members. And following functions

 Constructor

 Getter / Setters

 Input / Output

3. Make a class of “mergeArray”.

Input: A = {3, 5, 8, 10, 15, 25}

B = {4, 6, 45}

Output: C = {3, 4, 5, 6, 8, 10, 15, 25, 45}

You have to declare 2 arrays as data members of the class and following functions.

 Constructor

 Getter / Setters

 Input / Output

 Merge Array
Share:

0 comments:

Post a Comment