What will be the output of the following code 1 #include 2 using namespace std; 3...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
What will be the output of the following code 1 #include <iostream> 2 using namespace std; 3 class polygon{ 4 public: 5 void setWH(int a, int b) 6- { 7 width ma; height=b; 8) 9 protected: 10 11 }; 12- class Rectangle: public polygon { 13 public: 14- int area() { 15 int width, height; return (width" height); 16. } 17 }; 18- class Triangle : public polygon{ 19 public: 20 int area() { return (width * height/2); } 21 }; 22- int main (){ 23 Rectangle r1; 24 Triangle tl; 25 26 27 rl. setWH(4, 5); tl. setWH (4, 5); cout << r1.area() << " 28 return 0; 29 ) H <<t1.area()<< endl; What will be the output of the following code 1 #include <iostream> 2 using namespace std; 3 class polygon{ 4 public: 5 void setWH(int a, int b) 6- { 7 width ma; height=b; 8) 9 protected: 10 11 }; 12- class Rectangle: public polygon { 13 public: 14- int area() { 15 int width, height; return (width" height); 16. } 17 }; 18- class Triangle : public polygon{ 19 public: 20 int area() { return (width * height/2); } 21 }; 22- int main (){ 23 Rectangle r1; 24 Triangle tl; 25 26 27 rl. setWH(4, 5); tl. setWH (4, 5); cout << r1.area() << " 28 return 0; 29 ) H <<t1.area()<< endl;
Expert Answer:
Answer rating: 100% (QA)
Answer It seems there are some syntax errors in the provi... View the full answer
Related Book For
Business Statistics For Contemporary Decision Making
ISBN: 978-1118749647
8th edition
Authors: Black Ken
Posted Date:
Students also viewed these programming questions
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
If the individual subsidiary ledger accounts contained the following data: Cadence Company, Vendor, $200, credit balance Franklin Enterprises, Customer , $750, debit balance Marcelo Construction,...
-
A survey reveals that 2 out of 3 people prefer Coke to Pepsi. In a college class of 36 students, find how many students are likely to prefer Pepsi.
-
How will an expansionary monetary policy affect RGDP and the price level at less than full employment?
-
Last year, Token Corporation reported \($1,230,000\) in sales with a cost of goods sold of \($520,000,\) and operating expenses of \($440,000.\) The increase in the firms retained earnings was...
-
Yemi??s Drug Store has four employees who are paid on an hourly basis plus time-and a- half for all hours worked in excess of 40 a week. Payroll data for the week ended February 15, 2012, are shown...
-
The correct syntax of the re . sub ( ) function is re . sub ( string , replacement, pattern ) re . sub ( pattern , string, replacement ) re . sub ( replacement , pattern, string ) re . sub ( pattern...
-
Zim Company uses the following cost function: Y = $4200 + $5.25X. If the number of units produced in a month is 100, what would be the total cost?
-
Problem 4 A study of MBA graduates by Universum for The American Graduate Survey 2017 revealed that MBA graduates have several expectations from prospective employers beyond their base pay. In...
-
4. Solve the following systems: (a) x + x2 + 2x3 = 8 - -x1 2x + 3x3 1 3x17x2 + 4x3 = 10 (b) x+y+z=3 4x + 4y + 4z = 7 3xy + 2z = 5
-
Shown below is the block diagram of the datapath that was used for Greatest Common Divisor (GCD) calculation in the lab task. 19 else selA SelB LoadA LoadB AeqB else AltB Loadgcd done Y = A-B; end if...
-
Consider the two regions in the state of Central Ulna, Dockside and Lakeside. In both of these communities, household workers produce anchors and flour. Dockside workers: Produce 16 anchors or 4...
-
Directions: Read the newsletter Credit Cards. Complete the activities in the newsletter. These activities will not be submitted for grading. http://www.ogburn.org/PFLesson11.pdf Research and describe...
-
Using the Adjusted Trial Balance below, prepare an Income Statement for the year ended December 31. 20XX. Hinkleton Widgets Adjusted Trial Balance December 31, 20XX ACCOUNT TITLE DEBIT CREDIT Cash $...
-
What are the key differences in the hands of primates? Slow Loris Tarsier Macaque Spider Monkey Gibbon 11441
-
Suppose you need to answer any four of seven essay questions on a history test and you can answer them in any order. a. How many different question combinations are possible? b. What is the...
-
Compute the following probabilities by using the hyper-geometric formula. a. The probability of x = 3 if N = 11, A = 8, and n = 4 b. The probability of x < 2 if N = 15, A = 5, and n = 6 c. The...
-
The highway department wants to estimate the proportion of vehicles on Interstate 25 between the hours of midnight and 5:00 A.M. that are 18-wheel tractor trailers. The estimate will be used to...
-
Use the Wilcoxon matched-pairs signed rank test to determine whether there is a significant difference between the two groups of related data given. Use α = .10. Assume the underlying...
-
In 2012, the Federal Reserve joined many other central banks by making explicit a numerical target for inflation. Explain how stating that an annual inflation rate of 2 percent over the long run is...
-
While there is strong consensus among economists in favor of central bank independence, political support seems to be waning. What factors may have contributed to the rise in the political threat to...
-
The objective of a central bank is to reduce systematic risk in the economic and financial system. Specific objectives include: a. Low and stable inflation. b. High and stable growth and employment....
Study smarter with the SolutionInn App