Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write the answer for this in C++. Also, please strictly follow the instructions above, when writing the answer for this. Thank you in advance.

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Please write the answer for this in C++. Also, please strictly follow the instructions above, when writing the answer for this. Thank you in advance.

step 1 Let's have some fun! In this lab, we are going to create an abstract Pirate class. Then, we are going to create CaptainPirate and ZombiePirate child classesl Create the UML class diagram to show the inheritance relationship between the Parent class and the Child classes Open Visio and create a new diagram using the UML Class template Save the diagram as Week 6-Abstract Parent Class With Pirates Drag a class shape to your work area o Change the class name to Pirate o Add the following attribute and make it protected so that the Child classes have direct access to thenm name as a string (remember to make it protected by using a hashtag/pound symbol) o Add the following methods, and make them virtual so that the Child classes can override them - speak) that returns a string toString) that returns a string . We have a problem, though! How does a Pirate object speak? We have to know what kind of Pirate object it is so that we can tell it how to speak. In other words, a CaptainPirate is going to speak much differently than a ZombiePirate. Because we do not know how a general Pirate object speaks, we have to make the method abstract. In Visio, we make the method abstract by italicizing it (make the whole line italics) .It is time to do some inheritancel Drag another class shape to your work area, and place it below the Pirate class o Change the name of the new class to CaptainPirate o Add the following attribute, and make it private because we do not expect to create Child classes off of the CaptainPirate class. Notice that we do not need to add the name attribute because we inherit it from the Parent class - pet as a string o Add the following methods to override the parent's methods and to allow the child objects to behave differently than the parent objects - speak) that returns a string .toString) that returns a string

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Please describe the network address translation concept

Answered: 1 week ago

Question

1. Who should participate and how will participants be recruited?

Answered: 1 week ago

Question

3. How would this philosophy fit in your organization?

Answered: 1 week ago