Given the following definition of class Aclass (along with the definitions of its member functions). class...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Given the following definition of class Aclass (along with the definitions of its member functions). class Aclass ( k A (30 pts) . public 1 private: . . . . . Aclass(); Aclass( char ch, int num), int getvaluel() void print() char letter int valuel; Write the definition of the class named Bclass as follows: 6 pts It has the private data members firstm (integer value) and secondm (object of the class Aclass). /default value for data member letter is 'Z' and that for data member valuel is 0 return the value of the data member valuel print the values of the two data members It has the default constructor (the initial value for data member firstm is 10) and the constructor with a parameter for each of its data members. b. Write the definitions of the default constructor, the constructor with parameters and the member functions print() and computeSum() of class Bclass. 20 pts. It has a void public member function print() that outputs the values of its data members. It has a public member function int computeSum() that computes and returns the sum of the data members secondm.valuel and firstm. c. Write a statement to define the object of the class Bclass named bobj initialized with the value 'A' for data member secondm letter, 20 for data member secondm.valuel, and 30 for data member firstm. 4 pts B. (40 pts) a. Write the definition of the class named Cclass that is derived from (inherits) class Aclass as follows: 6 pts It has an additional private data member firstom (integer value). . • It has the default constructor (the initial value for data member firstm is 5) and the constructor with a parameter for each of its data members. The member function print() is overridden in this class: it also outputs the value of data member first in addition to the data members inherited. It has a public member function int computeSum() that computes and returns the sum of the data members value! and firstm. b. Write the definitions of the default constructor, the constructor with parameters and the member functions print() and compute Sum() of class Cclass. 20pts. c. Assume given the following definitions of objects and function process(): Aclass aobil, aobj2( Z, 60). Celass cobj( 'K', 90, 70): void process( Aclass obj) 1 obj.print(); Show the output produced by each of the following statements: 14 pts aobjl.print(); cobj.print(); cobj.Aclass:: print(); process(aobj2 ); process(cobj); aobj1 = cobj; aobj1.print(); Given the following definition of class Aclass (along with the definitions of its member functions). class Aclass ( k A (30 pts) . public 1 private: . . . . . Aclass(); Aclass( char ch, int num), int getvaluel() void print() char letter int valuel; Write the definition of the class named Bclass as follows: 6 pts It has the private data members firstm (integer value) and secondm (object of the class Aclass). /default value for data member letter is 'Z' and that for data member valuel is 0 return the value of the data member valuel print the values of the two data members It has the default constructor (the initial value for data member firstm is 10) and the constructor with a parameter for each of its data members. b. Write the definitions of the default constructor, the constructor with parameters and the member functions print() and computeSum() of class Bclass. 20 pts. It has a void public member function print() that outputs the values of its data members. It has a public member function int computeSum() that computes and returns the sum of the data members secondm.valuel and firstm. c. Write a statement to define the object of the class Bclass named bobj initialized with the value 'A' for data member secondm letter, 20 for data member secondm.valuel, and 30 for data member firstm. 4 pts B. (40 pts) a. Write the definition of the class named Cclass that is derived from (inherits) class Aclass as follows: 6 pts It has an additional private data member firstom (integer value). . • It has the default constructor (the initial value for data member firstm is 5) and the constructor with a parameter for each of its data members. The member function print() is overridden in this class: it also outputs the value of data member first in addition to the data members inherited. It has a public member function int computeSum() that computes and returns the sum of the data members value! and firstm. b. Write the definitions of the default constructor, the constructor with parameters and the member functions print() and compute Sum() of class Cclass. 20pts. c. Assume given the following definitions of objects and function process(): Aclass aobil, aobj2( Z, 60). Celass cobj( 'K', 90, 70): void process( Aclass obj) 1 obj.print(); Show the output produced by each of the following statements: 14 pts aobjl.print(); cobj.print(); cobj.Aclass:: print(); process(aobj2 ); process(cobj); aobj1 = cobj; aobj1.print();
Expert Answer:
Answer rating: 100% (QA)
The output of each statement is as follows aobj1print Outputs Z 60 cobjprint Outputs K 90 70 cobjAcl... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Given the following; CI f 95-99 4 90-94 4 85-89 11 80-84 3 75-79 4 70-74 2 Calculate; i.Mean ii.Median iii.Mode iv.The standard deviation
-
Hudson Company reports the following contribution margin income statement. HUDSON COMPANY Contribution Margin Income Statement For Year Ended December 3 1 Sales ( 9 , 6 0 0 units at $ 2 2 5 each ) $...
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
The current zero-coupon yield curve of semi-annually compounded rates for risk-free bonds is as follows: 1.0 Years 1.5 Years 2.0 Years 2.5 Years 3.0 Years 9.00% 10.20% 3.00% 4.00% 6.20% MATURITY 0.5...
-
Two samples of a slightly over-consolidated clay were tested in triaxial compression, and the following data at failure were obtained. The pre-consolidation stress for the clay was estimated from...
-
A congested computer network has a 0.002 probability of losing a data packet, and packet losses are independent events. A lost packet must be resent. (a) What is the probability that an e-mail...
-
State Hookes law.
-
Over the past 5 weeks, demand for wine at Winstons Winery has been 1,000, 2,300, 3,200, 1,750, and 1,200 bottles. Winston has placed weekly orders for glass bottles of 1,100, 2,500, 4,000, 1,000, and...
-
Deborah enters your office ready to discuss the project. She discusses her feedback on the plan thus far. She states that your team is doing an excellent job researching and you've been keeping her...
-
It is early April 2021 and you, CPA, work in a mid-sized accounting firm in Regina, Saskatchewan. While you normally work on audits, you have requested to participate in the personal tax pool this...
-
A new project has an initial cost of $148,000. The equipment will be depreciated on a straight-line basis to a book value of $49,000 at the end of the four-year life of the project. The projected net...
-
In 2008, the U.S. states and Canadian provinces adjoining the lakes negotiated the Great Lakes Compact to prevent the regions water from being shipped or piped to arid regions. The compact also...
-
Before you can use a Servlet such as FacesServlet on the server side from a Web browser, you need to map the FacesServlet to a path in your deployment descriptor file . a. Web pages b. WEB INF file...
-
Use the Java CallableStatement method to develop a data query from the Student and StudentCourse Tables with the StudentFrame class in the OracleSelectFaculty project (the project file can be found...
-
Navigation from one page to another can be done in two ways. One is directly to use code by writing a JSP tag such as or an HTML hyperlink in the JSF file. Another way that is provided by JSF is to...
-
UsePL-SQL to create a package, Student_Course, in the Oracle SQL Developer. The package contains a stored procedure namedSelectStudentCourse() with two positional parameters, a. The input student...
-
1. A projectile is fired with speed v0 at an angle ? from thehorizontal as shown in the figure Part A Find the highest point in the trajectory, H. Express the highest point in terms of the magnitude...
-
Heineken N.V., a global brewer based in the Netherlands, reports the following balance sheet accounts for the year ended December 31, 2016 (euros in millions). Prepare the balance sheet for this...
-
Write a template function maxn() that takes as its arguments an array of items of type T and an integer representing the number of elements in the array and that returns the largest item in the...
-
Rewrite the following so that it uses using declarations instead of the using directive: #include using namespace std; int main() { double x; cout < < "Enter value: "; while (! (cin >> x) ) { cout <...
-
Write a C++ program that asks for a distance in furlongs and converts it to yards. (One furlong is 220 yards.)
-
What is the quick (acid test) ratio? A. 0.9 B. 4.8 C. 0.8 D. 0.2 E. 1.7 Using the following balance sheet and income statement Balance sheet m Property 200 Trade payables Plant and equipment 300 Tax...
-
What is the receivables holding period? A. 21.6 days. B. 8 times. C. 19.4 days. D. 4.7 times. E. 28.2 days. Using the following balance sheet and income statement Balance sheet m Property 200 Trade...
-
The most appropriate measure of profitability from the point of view of the shareholders is: A. Return on equity. B. Return on capital employed. C. Return on non-current assets. D. Profit on sales.
Study smarter with the SolutionInn App