Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(a) Draw a class diagram representing the classes declared below. (b) Declare these classes in a file entitled BinaryOperators.h, inserting appropriate pre-compilation directives. Define


(a) Draw a class diagram representing the classes declared below. (b) Declare these classes in a file entitled "BinaryOperators.h", inserting appropriate pre-compilation directives. Define all the non-abstract methods in a source file entitled "BinaryOperators.cpp". Include also the definition of the function Test(). In this function use polymorphism to compute the following: 8+9, 8-9, 8*9, 8/9, 8/0. (c) Define main) in a source file entitled "main.cpp". Call Test) in main(). (d) Run you program and turn in the header files, source files, and the output of your program. class Binaryoperator ( public: Binaryoperator ( double opl, double op2 ) : f0pl ( opl ), fop2 ( op2 ) {} virtual double DoOp () const = 0; protected: const double fopl; const double fop2; }; // class Binaryoperator class Adder : public Binaryoperator { public: Adder ( double opl, double op2 ) : Binaryoperator ( opl, op2 ) {} virtual double DoOp () const; }; // class Adder class Subtractor : public Binaryoperator { public: Subtractor ( double opl, double op2) : Binaryoperator ( opl, op2 ) {} virtual double DoOp () const; }; // class Subtractor class Multiplier : public BinaryOperator { public: Multiplier ( double opl, double op2 ) : BinaryOperator ( opl, op2 ) {} virtual double DoOp () const; }; // class Multiplier class Divider : public Binaryoperator { public: Divider ( double opl, double op2 ) : BinaryOperator ( opl, op2 ) (0 virtual double DoOp () const; }; // class v void Test () ;

Step by Step Solution

3.31 Rating (151 Votes )

There are 3 Steps involved in it

Step: 1

Solution output Adder o... 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

Systems analysis and design in a changing world

Authors: John W. Satzinger, Robert B. Jackson, Stephen D. Burd

5th edition

9780324593778, 1423902289, 9781305117204, 324593775, 978-1423902287

More Books

Students also viewed these Programming questions