Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started