Problem

Write a program to illustrate how to use the class temporary, designed in Exercises 13 a...

Write a program to illustrate how to use the class temporary, designed in Exercises 13 and 14 of this chapter. Your program should not use the statements given in Exercises 15 and 16. Also, your program must contain statements that would ask the user to enter data of an object and use the member function set to initialize the object.

REFERENCE:

13

The number in parentheses at the end of an exercise refers to the learning objective listed at the beginning of the chapter.

Consider the following statements: (1, 2, 3, 5, 7)

14

Assume the definition of class temporary as given in Exercise 13. Answer the following questions: (1, 2, 3, 5)

a. Write the definition of the member function set so that the instance variables are set according to the parameters.

b. Write the definition of the member function manipulate that returns a decimal number as follows: If the value of description is "rectangle", it returns first * second; if the value of description is "circle", it returns the area of the circle with radius first; if the value of description is "sphere", it returns the volume of the sphere with radius first; if the value of description is "cylinder", it returns the volume of the cylinder with radius first and height second; otherwise, it returns the value -1.

c. Write the definition of the function print to print the values of the instance variables and the values returned by the function manipulate.

d. Write the definition of the constructor so that it initializes the instance variables using the function set.

e. Write the definition of the remaining functions to set or retrieve the values of the instance variables. Note that the function get returns the values of all instance variables.

15

Assume the definition of class temporary as given in Exercise 13. What is the effect of the following statements? (1, 5)

16

Assume the definition of class temporary as given in Exercise 13 and the definitions of the member functions and the constructor as specified in Exercise 14. What is the output of the following statements? (3, 5)

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 10
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT