Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ class, AllKinds, that has three member variables of type int, long, and float. The class must have a default constructor that

 

Write a C++ class, AllKinds, that has three member variables of type int, long, and float. The class must have a default constructor that initializes every variable to -1, have another constructor that takes in each variable type to initialize (three arguments), and have "getters" and "setters" for each type. (Example: get Int (), set Int () ...) Have public functions long intPlusLong (); float intPlus Float (); float longMinus Float (); that take the sum or difference of the internal variables as implied by function name. Write a simple main() function to declare two instances of this class, one using the default constructor and one using the initialization constructor. For the class constructed with the default constructor, set each internal member variable of that class to a new number. Then call each arithmetic operator on both classes and print out the result. Select test values to demonstrate that your class is fully operational.

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_2

Step: 3

blur-text-image_3

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

Data Structures And Algorithms In C++

Authors: Michael T. Goodrich, Roberto Tamassia, David M. Mount

2nd Edition

978-0470383278, 0470383275

More Books

Students also viewed these Computer Network questions

Question

Compute Paasches index for 2013 using 2000 as the baseperiod.

Answered: 1 week ago

Question

Determine a value index for 2013 using 2000 as the baseperiod.

Answered: 1 week ago