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...
-
What does it mean for a producer or consumer to internalize an externality? What would cause a producer or consumer to internalize an externality?
-
Rank the following in order of increasing acidity. NO2 CF3 CF3
-
Distinguish between syntactics, semantics and pragmatics. Are these perspectives independent of each other or are they interwoven?
-
Digital Software Inc., has two product lines. The income statement for the year ended December 31 shows the following: The products, Num 1 and Num 2, are sold in two territories, North and South, as...
-
Watch both clips below The Exorcist - father Damian (youtube) The exorcism of the young girl, Regan (Youtube) 1. Father Damian is a Catholic priest. How does his experience at the end of the film...
-
In Florida sunscreen and sunglasses are vital items If the tax on sellers of these items is doubled from 5.5 percent to 11 percent who will pay most of the tax increase the buyer or the seller. Will...
-
Calculate the sensible and latent cooling load (kW) for a building located in Jeddah at 1:00 PM due to infiltration only using ACH method. Use the following data: Building dimensions 50 m x 20 m x 5...
-
Luthan Company uses a plantwide predetermined overhead rate of $ 2 2 . 2 0 per direct labor - hour. This predetermined rate was based on a cost formula that estimated $ 2 6 6 , 4 0 0 of total...
-
Use the method of substitution to solve the following system of linear equations. The answer will be a coordinate point with integer values of x and y. x-2y= -4 3x + y = -5 A/
-
Warnerwoods Company uses a perpetual inventory system. It entered into the following purchases and sales transactions for March. Date Activities Units Acquired at Cost Units Sold at Retail March 1...
-
Ricky s Piano Rebuilding Company has been operating for one year. On January 1 , at the start of its second year, its income statement accounts had zero balances and its balance sheet account...
-
This problem refers to right triangle ABC with C = 90 Begin the problem by drawing a picture of the triangle with both the given and asked for information labeled appropriately. If B = 51.88 and b =...
-
Miller Co. incurred the following computer software costs for the development and sale of software programs during the current year: Planning costs $50,000 Design of the software 150,000 D...
-
A stock has had returns of 8 percent, 26 percent, 14 percent, 17 percent, 31 percent, and 1 percent over the last six years. What are the arithmetic and geometric average returns for the stock?
-
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.)
-
Estimate the fundamental frequency for the tapered beam of Figure 8.17 where \[ m(x)=m(1-x / L) \] and \[ E A(x)=E A(1-x / L) \] Compare your result to the exact value of \(\omega_{1}=\) \(2.40...
-
Derive the differential equation of motion for a nonuniform plate with varying thickness. Assume that the material properties such as Young's modulus and Poisson's ratio remain constant.
-
For the tapered beam sketched in Figure 8.17 undergoing transverse vibration, estimate the first two natural frequencies using the Rayleigh-Ritz procedure. Assume a trial function of the form...
Study smarter with the SolutionInn App