Write a C++ class, AllKinds, that has three member variables of type int, long, and float....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Related Book For
Data Structures And Algorithms In C++
ISBN: 9780470383278
2nd Edition
Authors: Michael T. Goodrich, Roberto Tamassia, David M. Mount
Posted Date:
Students also viewed these computer network questions
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
answer the question clearly You are building a flight-control system for which a convincing safety case must be made. Would you assign the tasks of safety requirements engineering, test case...
-
[21] The Assembler uses a Location Counter (LC) to: a) Keep track of the location of both instructions and operands being b) Count the number of symbols on the assembly program. c) Save the Pass...
-
Identify and briefly describe three m-commerce applications you or a friend have used.
-
How can ABC systems be used to manage better?
-
The cost of reworking defective products before shipping to customers would be classified as which type of quality costs? a. Prevention cost b. Appraisal cost c. Internal failure cost d. External...
-
The trial balance columns of the worksheet for Gibson Roofing at March 31, 2012, are as follows. Other data:1. A physical count reveals only $550 of roofing supplies on hand.2. Depreciation for March...
-
1. If the wavelength of a-line of Lyman series in hydrogen atom is , find the wavelength of -line of Paschen series. 3256 (b) 36x5 22 (c) 3522 26 (d) 32 x5 26 2. If temperature of a liquid is...
-
8 91426 10 11 (CCM) builds furniture for a range of commercial customers. They build furniture used in hotels and department stores, on cruise liners, ferries and passenger aircraft. One of their...
-
Suppose that you believe the fundamental value of Wal-Grey stock is about to rise from $50 to $100 because of its new management team. You have $20,000 that you can risk in the market, and you can...
-
Describe two selection tests that could be used to select ideal candidates for the position (front office of Bay Plaza Hotel in New Zealand .
-
signal is a special case It's what we could call a bounce signal, where the process isn't just killed but instead is signaled to end and then restart bef OSIGSTOP or 23 OSIGINT, or 2 The SIGTERM, or...
-
and five different currencies. The rates are quoted in terms of the number of units of Below are the exchange rates between the U.S. dollar the foreign currency to the dollar. Euro British pound...
-
In problems 1-5, Use the limit of a quotient difference definition of the derivative to determine the derivative f'(x) of the function. 1. ( ) f(x) = 2x 2. ( ) f(x) = x + 1 1 x+1 3. ( 4. ( 5. ( 6. (...
-
Discuss two methods (Interviews and...) to select candidates for the position (front office from Bay Plaza Hotel in New Zeland). Explain why these two methods are appropriate.
-
1. The slab, beam and column system has been shown in Figure 1 (Plan) and Figure 2 (Front Elevation) is for education purpose building (School Building). The room clear height is 12 feet. The...
-
When the Department of Homeland Security created a color-coded system to prepare government officials and the public against terrorist attacks, what did it do right and what did it do wrong?
-
What is the longest prefix of the string "cgtacgttcgtacg" that is also a suffix of this string?
-
Prepare an implementation of splay trees that uses bottom-up splaying as described in this chapter and another that uses top-down splaying as described in Exercise C-10.23. Perform extensive...
-
Give a fully generic implementation of the class Linked Binary Tree using class templates and taking into account error conditions.
-
See the option quote on IBM from the CBOE Web site on the next page showing options expiring in March and April 2022. a. Which option contract had the most trades that day? b. Which option contract...
-
Two European call options with a strike price of \($50\) are written on two different stocks. Suppose that tomorrow, the low-volatility stock will have a price of \($50\) for certain. The...
-
It is February 21, 2022, and you have decided to purchase 10 June call contracts on eBays stock with an exercise price of \($57.50.\) Because you are buying, you must pay the ask price. How much...
Study smarter with the SolutionInn App