Question: a ) Create a class called duodecimal for an integer duodecimal number with up to three digits that has separate int member data for the
aCreate a class called duodecimal for an integer duodecimal number with up to three digits that has separate int member data for the three digits. One constructor should initialize this data to and another should initialize it to fixed values. Another member function should display it egX The final member function, addduodecimal, should add two objects of type duodecimal passed as arguments. A main program should create two initialized duodecimal objects should they be const? and one that isnt initialized. Then it should add the two initialized values together, leaving the result in the third duodecimal variable. Finally it should display the value of this third variable. Make appropriate member functions const.
b
Modify the duodecimal class from a so that instead of a function addduodecima it uses the overloaded operator to add two duodecimal numbers. Write a program to test this class.
c
Create a template class with a nontype for the radix. Demonstrate this class with a driver program similarly to a and b
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
