(a) Draw a class diagram representing the classes declared below. (b) Declare these classes in a...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
(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 () ; (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 () ;
Expert Answer:
Related Book For
Systems analysis and design in a changing world
ISBN: 978-1423902287
5th edition
Authors: John W. Satzinger, Robert B. Jackson, Stephen D. Burd
Posted Date:
Students also viewed these programming questions
-
Write a regular expression for a string literal defined as follows: - Starts and ends with a double quote symbol. - Can contain any number of characters that are not a " or a \. - Can also contain...
-
X CO produces a 16 ounce can of BR at a cost of $1.80 to make and sells for $3.00. 16 ounces of BR can be further refined into 4 small tins of CP. The chrome polish sells for $5.00 per tin. Variable...
-
Sungsam Corporation, a US-based conglomerate, is considering expanding its operations in India. As the group's chief financial officer, you are asked to estimate the firm's weighted average cost of...
-
In the Diffie-Hellman protocol, what happens if, x and y have the same value? That is, Alice and Bob have accidentally chosen the same number. Are the values of R1 and R2 the same? Are the values of...
-
Suppose that T (R"; R'") for some n,m N. a) If T(l, 1) = (3, , 0) and T(0, 1) = (4,0, 1), find the matrix representative of T. b) If T(l, I, 0) = (e, ), T(0,-1, 1) = (1, 0), and T(l, 1,-1) = (1.2),...
-
For Exercises 1122, use Cramers Rule to solve each system. 2x + y = 3 x - y = 3
-
A tube bank uses an aligned arrangement of \(30-\mathrm{mm}\) diameter tubes with \(S_{T}=S_{L}=60 \mathrm{~mm}\) and a tube length of \(1 \mathrm{~m}\). There are 10 tube rows in the flow direction...
-
Find the following values using the equations and then a financial calculator. Compounding/discounting occurs annually. a. An initial $500 compounded for 1 year at 6% b. An initial $500 compounded...
-
Nike had sales of $36.362 billion in 2018. Suppose you expected its sales to grow at a rate of 12% in 2019, but then slow by 1% per year to the long-run growth rate that is characeristic of the...
-
J.D. Power and Associates surveys new automobile owners to learn about the quality of recently purchased vehicles. The following questions were asked in the J.D. Power Initial Quality Survey, May...
-
During gym class Sally noticed that her friend Melissa always ran faster than her. Sally knew that they exercised equally, so she wondered what could cause Melissa to run so fast. Sally began to...
-
Choose one of the recent laws that have been enacted that are included in the chapter and discuss why it is or isnt an effective stop-gap to health care fraud and abuse.
-
EMTALA is a far-reaching act; explain several of its benefits and describe how it is effective at preventing fraud and abuse as opposed to detecting it.
-
Comparing projects with unequal lives is often done by comparing the projects annualized net present value. Based on the information provided at MFL, use a spreadsheet to compare projects based on...
-
While working on your homework for this course and surfing the Internet to check out all the fascinating links, you realize the person who manages the branch of the new durable medical equipment...
-
In July 2013, heavy rains in Cleveland caused a retaining wall inside the Terminal Tower for the Regional Transit Authority (RTA) train to collapse. It was estimated that between repairs and lost...
-
Consider the following table, which gives a security analyst's expected return on two stocks in two particular scenarios for the rate of return on the market. Assume that both scenarios are equally...
-
Coastal Refining Company operates a refinery with a distillation capacity of 12,000 barrels per day. As a new member of Coastal's management team, you have been given the task of developing a...
-
Set up a meeting with the chief analysts of a medium- or large-scale development project and discuss the transition from analysis to design for that project. How and when were key architectural...
-
What are some key issues to consider when organizing a project team?
-
How is the SDLC based on the problem-solving approach described in Chapter 1?
-
Describe the process of going public using an IPO, starting with underwriter selection and proceeding through the various stages that lead to determination of an issue price.
-
Identify at least four methods by which investors and/or the entrepreneur in a new venture can harvest their investment in a new venture. Describe the costs and benefits of each, and provide a...
-
From the perspective of the entrepreneur, what are the pros and cons of an IPO as opposed to private sale of the venture to a public company in exchange for stock or cash?
Study smarter with the SolutionInn App