1 / 2

PRG 218 Week 5 Individual Assignment Coding: Derived Classes//tutorfortune.com

PRG 218 Week 5 Individual Assignment Coding: Derived Classes//tutorfortune.com<br><br>Click on below link to buy<br>https://tutorfortune.com/products/prg-218-week-5-individual-assignment-coding-derived-classes<br><br><br>Instructions: <>The Grading Guide for this assignment is available and can be used as a check list for completing this assignment. <> Create a base class and two derived classes. Also, create and call a member function named communicate() that behaves differently when called by each class. Create a single C project (and CPP source file) named animal_communication as follows: <br>u2022tInto this source, type the source code for Program 15-16, "Program Output," in Section 15.6, "Polymorphism and Virtual Member Functions," in Ch. 15, "Inheritance, Polymorphism, and Virtual Functions," of Starting Out with C from Control Structures Through Objects. <br>u2022tRun and debug the code as necessary.<br>u2022tCreate a new class named Cat that derives from the base class Animal.<br>u2022tIn the main portion of the program, add code to instantiate the Cat class and telegraph that the Cat class's constructor and destructor are being called. Note: To do this, you may copy and customize the code that does this for the Dog class, choosing a variable name such as myAnimal2 for the instantiation of the Cat object.<br>u2022tCreate a member function called communicate() in the base Animal class, the Cat class, and the Dog class. The communicate() member function should produce "Speak" when called on an instance of Animal, "Woof!" when called on an instance of Dog, and "Meow!" when called on an instance of Cat as follows: // Class member function for Animal // Place public function below the constructor // and destructor in the Animal class. void communicate() { cout << "Speak." << endl; }<br> <br>// Class member function for Dog // Place public function below the constructor // and destructor in the Dog class. void communicate() { cout << "Woof!" << endl; }<br> <br>// Class member function for Cat // Place public function below the constructor // and destructor in the Cat class. void communicate() { cout << "Meow!" << endl; }<br>u2022tIn the main portion of your program, instantiate the Animal, Cat, and Dog classes as shown below, and then call the communicate member function on each instance as follows: int main() { Animal genericAnimal; genericAnimal.communicate();<br> <br>Dog ralph; ralph.communicate();<br> <br>Cat fluffy; fluffy.communicate();<br> <br>return 0; } Save your C code in a file named Week5Program_YourName.cpp, and take a screenshot of your running program. Copy your screenshot in to Microsoftu00ae Word document. Zip both your screenshot document and CPP source into a single ZIP file named PRG218_Week5_YourName.zip. Submit your ZIP file using the Assignment Files tab.<br>Individual Nov 27, 2017 11:59 PM 14<br>Remember your APA style Title Page. The Grading Guide for this assignment is available.<br><br>Click on below link to buy<br>https://tutorfortune.com/products/prg-218-week-5-individual-assignment-coding-derived-classes<br>

ceram
Download Presentation

PRG 218 Week 5 Individual Assignment Coding: Derived Classes//tutorfortune.com

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


More Related