Create a base class called shape. Use this class to store two double type values that...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Create a base class called shape. Use this class to store two double type values that could be used to compute the area of figures. Derive two specific classes called triangle and rectangle from base shape. Add to the base class, a member function get_data() to initialize base class data members and another member function display_area() to compute and display the area of figures. Make display_area() as a virtual function and redefine this function in the derived class to suit their requirements. Using these three classes, design a program that will accept dimensions of a triangle or a rectangle interactively and display the area.Remember the two values given as input will be treated as lengths of two sides in the case of rectangles and as base and height in the case of triangle and used as follows: Area of rectangle = x * y Area of triangle = ½ *x*y Create a base class called shape. Use this class to store two double type values that could be used to compute the area of figures. Derive two specific classes called triangle and rectangle from base shape. Add to the base class, a member function get_data() to initialize base class data members and another member function display_area() to compute and display the area of figures. Make display_area() as a virtual function and redefine this function in the derived class to suit their requirements. Using these three classes, design a program that will accept dimensions of a triangle or a rectangle interactively and display the area.Remember the two values given as input will be treated as lengths of two sides in the case of rectangles and as base and height in the case of triangle and used as follows: Area of rectangle = x * y Area of triangle = ½ *x*y
Expert Answer:
Related Book For
Mathematical Applications for the Management Life and Social Sciences
ISBN: 978-1305108042
11th edition
Authors: Ronald J. Harshbarger, James J. Reynolds
Posted Date:
Students also viewed these computer engineering questions
-
Create a base class called Vehicle that has the manufacturer's name (type String), number of cylinders in the engine (type int), and owner (type Person given in Listing 8.1Truck that is derived from...
-
In Exercises 1 and 2, compute the area of the triangle with the given vertices using both methods. 1. A = (1, - 1), B = (2, 2), C = (4, 0) 2. A = (3, - 1, 4), B = (4, -2, 6), C = (5, 0, 2) Figure 1...
-
A base class called Shape and derived classes called Circle, Square, and Triangle. In the base class, make a virtual function called draw( ), and override this in the derived classes. Make a pointer...
-
In the context of online marketing communications, briefly explain what viral marketing is. Is it a worth-while pursuit for marketing organizations?
-
1. An electric field of magnitude 0.450 N/C exerts a force of 8.00 x 104 N on a test charge placed in the field. What is the magnitude of the test charge? 2. An electric field of magnitude 0.370 N/C...
-
A company estimates its manufacturing overhead will be $750,000 for the next year. What is the predetermined overhead rate given the following independent allocation bases? A. Budgeted direct labor...
-
We will use the Minitab macro NormNP, or the R function normnp, to nd the posterior distribution of the normal mean when we have a random sample of size n from a normal( , 2 ) distribution with...
-
Assume the same facts as Problem 11-8 with the following exceptions: a. Tobacs functional currency is the U.S. dollar. b. Balfours investment in Tobac consists of the following: Initial investment...
-
1. Letter of the word INDIANOIL are arranged in all possible ways. The number of permutations in which A, I, O occur only at odd places, is : (a) 720 2. (b) 360 (c) 240 (d) 120 How many different...
-
Part of Glo's strategic plan is to capture market segments that are traditionally underserved. Glo's management believes that the market for men's care products is underserved and would be an...
-
From the variance analysis we find a favorable material price variance of 280 and an unfavorable quantity variance of 180. Based on these variances, which of the following statements is true? a) The...
-
Explain the stages a company goes through as its management orientation evolves from domestic and ethnocentric to global and geocentric.
-
Explain how a nation can achieve competitive advantage, and list the forces that may be present in a national diamond.
-
It is a safe bet that most people reading this textbook are familiar with Red Bull. The $6.4 billion company that largely created the market for energy drinks revels in its association with cultural...
-
In November 2015, VW faced even more bad news. It was revealed that some three-liter, six-cylinder engines in cars produced by Audi, one of Volkswagen AGs luxury brands, also contained defeat...
-
Explain the strategic/consultative selling model in relation to selling in the global context.
-
Use the following information in Onifade Manufacturing Organization. Dividend $150,000 Transportation OUT $70,000 Transportation In for materials purchased $90,000 Work in process Jan 1, 2016...
-
Why should you not model a decision variable as a random variable with a probability distribution?
-
The population P of India (in billions) for 2000-2050 can be approximated by the equation P = 0.924t0.13 where t > 0 is the number of years past 2000. (a) Express this equation with radical notation....
-
A retired woman has $120,000 to invest. She has chosen one relatively safe investment fund that has an annual yield of 9% and another, riskier fund that has a 13% annual yield. How much should she...
-
Solve each system by elimination or by any convenient method? 1. 2. 3. 4. S7x + 2y = 26 4 %3D 16 S 2x + 5y = 24 -6x + 2y = 30
-
Working in a small group, collect credit card marketing information or the summary of account information sent to cardholders for three to five different cards. Be sure to protect the identity of the...
-
Interview individuals who represent the three stages of the financial life cycle about their credit card usage. How many cards do they have? What kind or class of cards (rebate, premium, affinity,...
-
Break into two or three groups to research the use of affinity cards. First, develop a list of affinity cards and their sponsors. Does your university sponsor a card? Next, each group should choose a...
Study smarter with the SolutionInn App