Given the following header file: Animals.h #ifndef ANIMALS_H #define ANIMALS_H #include class Animal { public: Animal...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Given the following header file: Animals.h #ifndef ANIMALS_H #define ANIMALS_H #include <string> class Animal { public: Animal ( const std::string& name ) : fname ( name ) {} virtual void Speak () const = 0; protected: std::string fName; }; // class Animal class Dog : public Animal { public: Dog ( const std::string& name ) : Animal ( name ) {} virtual void Speak () const; }; // class Dog class Cat : public Animal { public: Cat ( const std::string& name ) : Animal ( name ) {} virtual void Speak () const; }; // class Cat class Tiger : public Animal { public: Tiger ( const std::string& name ) : Animal ( name ) {} virtual void Speak () const; }; // class Tiger void TestAnimals (); #endif (a) Draw a Class Diagram to represent the objects declared. [50] (b) Define the TestAnimals () function to produce the following: [50] woof! My name is Rover. Meow! My name is Tabby. Roar! My name is Mike. Meow! My name is Tabby Jr. Woof! My name is Rover Jr. (c) Rewrite the above in Java. [Extra credit 20] Given the following header file: Animals.h #ifndef ANIMALS_H #define ANIMALS_H #include <string> class Animal { public: Animal ( const std::string& name ) : fname ( name ) {} virtual void Speak () const = 0; protected: std::string fName; }; // class Animal class Dog : public Animal { public: Dog ( const std::string& name ) : Animal ( name ) {} virtual void Speak () const; }; // class Dog class Cat : public Animal { public: Cat ( const std::string& name ) : Animal ( name ) {} virtual void Speak () const; }; // class Cat class Tiger : public Animal { public: Tiger ( const std::string& name ) : Animal ( name ) {} virtual void Speak () const; }; // class Tiger void TestAnimals (); #endif (a) Draw a Class Diagram to represent the objects declared. [50] (b) Define the TestAnimals () function to produce the following: [50] woof! My name is Rover. Meow! My name is Tabby. Roar! My name is Mike. Meow! My name is Tabby Jr. Woof! My name is Rover Jr. (c) Rewrite the above in Java. [Extra credit 20]
Expert Answer:
Answer rating: 100% (QA)
a b include include using namespace std class Animal publi... View the full answer
Related Book For
International Marketing
ISBN: 978-1452226354
1st edition
Authors: Daniel W. Baack, Eric G. Harris, Donald Baack
Posted Date:
Students also viewed these programming questions
-
1. Implement the CheckingAccount.java based on the UML below. CheckingAccount is a subclass of BankAccount. A checking account has a transaction fee that is associated with all deposits and...
-
Instructions DebugOne1.java 1 public class DebugOne1 2 { The files provided in the code editor to the /* This program displays a greeting public void main(String[] args) right contain syntax and/or...
-
public class Person { // person name protected String name; // defualt constructor public Person() { name ="No Name Yet"; } // 1st argument constructors public Person(String initialName) { name =...
-
Under a plan of complete liquidation, Coast Corporation distributes land with a $300,000 adjusted basis and a $400,000 FMV to William, a 25% shareholder. William has a $200,000 basis in his Coast...
-
Suppose that a, b, c R3 are three points which do not lie on the same straight line and that U is the plane which contains the points a, b, c. Prove that an equation of II is given by ra -a2 a3
-
In Exercises 2528, the first screen shows the augmented matrix, A, for a non square linear system of three equations in four variables, w, x, y, and z. The second screen shows the reduced row-echelon...
-
A circular transistor of \(15-\mathrm{mm}\) diameter is cooled by impingement of an air jet exiting a 3-mm-diameter round nozzle with a velocity of \(20 \mathrm{~m} / \mathrm{s}\) and a temperature...
-
Suppose that the economy is initially in a steady state and that some of the nations capital stock is destroyed because of a natural disaster or a war. (a) Determine the long-run effects of this on...
-
A savings account pays 36% interest per annum compounded continuously. How much must be invested now in order to accumulate to $100,000 at the end of 10 years? Explain the significance of the...
-
The Molokai Nut Company (MNC) makes four different products from macadamia nuts grown in the Hawaiian Islands: chocolate-coated whole nuts (Whole), chocolate-coated nut clusters (Cluster),...
-
In order to improve business, the Wiessherr Biergarten in Augsburg, Germany began a new gimmick promotion, the "bier fountain". The patron steps on a floor-mounted bellows which forces a column of...
-
For Problem 8.14, calculate the real and reactive power delivered to the three-phase load. Data From Problem 8.14:- The voltages given in Problem 8.10 are applied to a balanced-Y load consisting of...
-
Rework Problem 6.2 with the value of \(\mathrm{A}_{11}\) changed to 4 . Data From Problem 6.2:- Using Gauss elimination and back substitution, solve \[\left[\begin{array}{ccc}6 & 2 & 1 \\4 & 10 & 2...
-
Repeat the above problem with the swing bus voltage changed to \(1.0 / 30^{\circ}\) per unit. Data From Above Problem:- Assume a \(0.8+j 0.4\) per unit load at bus 2 is being supplied by a generator...
-
The interest expense on debt provides a tax deduction for the issuer so any calculation of a firms net cost of debt should reflect this benefit. Based on the information provided at MFL, compute a...
-
Repeat Problem 6.37 except use an initial voltage guess of \(0.25 / 0^{\circ}\). Data From Problem 6.37:- The bus admittance matrix of a three-bus power system is given by \[ Y_{\text {bus...
-
Compute the following for the function defined below. Simplify your answers. Note: Use lowercase letters in your answers. f(x) = 3x2-2x+8 (a) f(a) = (b) f(a+h) - = (c) f(a+h) -f(a)= (d) f(a + h) f(a)...
-
The relationship described in question 7 does not always appear to hold. What factors, besides the number of firms in the market, might affect margins?
-
How would cultural imperatives, electives, and exclusives affect the development of new target markets? How would they affect personal selling? How would they influence advertising programs?
-
Litigation is often the least attractive of the conflict resolution choices. Create a table listing the advantages and disadvantages of conciliation, arbitration, and litigation. Then pick the best...
-
What factors would lead a researcher to be biased when performing international research?
-
A plane layer of coal of thickness \(L=1 \mathrm{~m}\) experiences uniform volumetric generation at a rate of \(\dot{q}=10 \mathrm{~W} / \mathrm{m}^{3}\) due to slow oxidation of the coal particles....
-
The steady-state temperature distribution in a onedimensional wall of thermal conductivity \(k\) and thickness \(L\) is of the form \(T=a x^{2}+b x+c\). Derive expressions for the heat fluxes at the...
-
One-dimensional, steady-state conduction with no energy generation is occurring in a plane wall of constant thermal conductivity. (a) Is the prescribed temperature distribution possible? Briefly...
Study smarter with the SolutionInn App