Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

CISP 400 Midterm 2name You must write legibly to receive full credit on this exa

ID: 3700651 • Letter: C

Question

CISP 400 Midterm 2name You must write legibly to receive full credit on this exam fI cannot decipher your writing you will receive a deoreased grade. For questions 1-6 consider the following coder include ciostrean> using hanespace std conat double AVGOOST 20000 const double BERTH TAX1.1 enum BoatType1 tug, sall class Boat double _price; BoatType BoatType publie: Boat { -price-02) Boat ( double p ) { -price . P; }; double Price { }const( return ( -price ); } doubles Price ( returnpricea i bool AboveAverage ( ) corat { return ( Price() > AVOCO ST ); }, virtual BoatType TypeDfBoat ()conat-0 class Pleasureboat : publie Boat double sails publie: Pleasureboat Pleasureboat 1 double p, double s-211 Bost (pl. ails(s) a class WorkBoat: public Boat double payload: public: WorkBoat t WorkBoat t double p, double pl 1Boat (p) I payload pli a BoatType TypeofBoat const ( return t tug : 1 bool Abovekveraget const I returnt Price)AVGOOST BERTH TAX a l a conat unsigned NOMBER-3 int main t PleasureBoat PB1 (190001 WorkBloat WB1 119950, 1.001 WorkBoat WB2 (20001,1.00) return 0

Explanation / Answer

Boats[1]-> AboveAverage() WorkBoat::AboveAverage()

Boats[2]-> AboveAverage() WorkBoat::AboveAverage()

WB3->AboveAverage()    WorkBoat::AboveAverage()

________________

4)

If we want different implementaton in the derived class for the Same function declared in the Base class(Super class) then we have to override the same function in the derived class and provide implementation there.

So that we will have the same function name in the derived class but with different functionality.

________________Thank You