Description of this paper

C++ Program




Develop a class which is called DecimalClass. This class has two data members. The first one is an integerPart and the second is a decimalPart. For example if num1 is an object of Decimal Class and its integerPart is 100 and decimalPart is 33, the floating point number which num1 represents is 100.33. In this class you need to overload the + (addition) and the - (substraction) operators to add the two objects of DecimalClass. If the sum of the decimalPart after adding two objects are greater than 100 deduct 100 from the DecimalPart and add 1 to integerPart. Similarly if the difference of the decimalPart after subtracting one objects from other is negative, deduct 1 from the intergerPart and add 100 to decimalPart.;Here is an example;Sum Example;Object Integer Part Decimal Part;num1 48 31;num2 23 71;num1+num2 72 2;Subtraction Example;Object IntegerPart decimalPart;num1 48 31;num2 23 71;num1-num2 24 60;You need to write a test program (main) which declares at least 4 objects of the DecimalClass and performs the addition and subtraction of the different objects. You should also have functions to display the data members of each object and the results.


Paper#64016 | Written in 18-Jul-2015

Price : $27