Answered step by step
Verified Expert Solution
Link Copied!

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

a)Create 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 0, and another should initialize it to fixed values. Another member function should display it, e.g.1X2. The final member function, add_duodecimal, 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 add_duodecima() 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic6 Database Programming

Authors: John W. Fronckowiak, David J. Helda

1st Edition

0764532545, 978-0764532542

More Books

Students also viewed these Databases questions

Question

=+What is the nature of the unions in the particular country?

Answered: 1 week ago