Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

1. Design and implement an abstract base class ArithmeticExpression that represent any binary (having two arguments) arithmetic expression. In this coursework you will be implementing various subclasses of this class. The abstract class should include at least
two methods called evaluate and display which are described below. 
2. Design and implement concrete (non-abstract) classes which are subclasses of the class ArithmeticExpression and represent some simple arithmetic expression. The operations that you should implement for each subclass should include the binary (i.e. accepting exactly two arguments) operations of addition, subtraction, multiplication and division (all of them accepting double type arguments). Using the classes you should be able to represent for example an expression like "(5.0+8.1)*(2.0)" (not in this format but represent the overall expression in an equivalent way). To design your classes you should think what common functionality and di erences ( elds and methods) these classes share and place such functionality at the appropriate place of the class hierarchy. Implement methods evaluate and display. Method evaluate evaluates the arithmetic expression that the object represents and returns the result as a double. For exam- ple, calling it in an object representing expression "(5.0+8.1)*(2.0)" should return 26.2. Method display prints the raw (unevaluated) expression on the screen. For example, calling it in an object representing expression "(5.0+8.1)*(2.0)" should display the string "(5.0+8.1)*(2.0)" (without the quotes). You shoud NOT use static methods!

3. Implement a test class CalculatorTest which tests the functionality of your classes (the methods of your classes should be called and make sure that they do what they are supposed to do).
1
4. Implement a class RandomCalculations which creates a random number of random ex-pressions and uses your classes above to evaluate and display them. Test its functionality by calling its methods in the CalculatorTest class above 

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9651494

Have any Question?


Related Questions in Computer Engineering

According to the same national collegiate athletic

According to the same National Collegiate Athletic Association data, the means and standard deviations of eligibility and retention rates (based on a 1,000-point scale) for the 2013-2014 academic year are presented, alon ...

Can someone design a small program for me in java that do

Can someone design a small program for me in Java that do the following: Implement at least four classes (showing inheritance) with suitable constructors and methods to set/retrieve values of from the properties. Try to ...

Question state the dilemma the score as he puts it harnish

Question : State the dilemma ("the score", as he puts it) Harnish finds between the Humean view and the Frege-Russell view of representation. Do you think a computational theory of mind is a viable alternative to these v ...

Systems analysis assignment can you answer the 4 questions

Systems Analysis assignment : Can you answer the 4 questions please? Continuing Case: Personal Trainer, Inc. Personal Trainer, Inc. owns and operates fitness centers in a dozen Midwestern cities. The centers have done we ...

A firm faces the following inverse demand curvep

A firm faces the following inverse demand curve P= 54-0.5Q Where P is the price of output and Q is the number of outputs sold per hour. This firm is the only employer in town and faces an hourly supply of labor given by: ...

Mark harris just received a cash gift from his grandfather

Mark Harris just received a cash gift from his grandfather. He plans to invest in a five-year bond issued by Cullumber Corp. that pays an annual coupon rate of 4.5 percent. If the current market rate is 7.50 percent, wha ...

Jason who is very knowledgeable regarding computers agrees

Jason, who is very knowledgeable regarding computers, agrees to purchase computers for Nick's business. Jason is retained for that purpose only, he is paid a set rate for the job, and Nick exercised no control over the m ...

Access your browsers security settings and configure the

Access your browser's security settings and configure the browser to refuse all cookies or to prompt you before allowing a cookie. Restart the browser; then visit several different Web sites. Be sure to visit popular sit ...

Question a simm has a capacity of 32mx64how many 32mx8

Question : A SIMM has a capacity of 32Mx64. How many 32Mx8 DRAMa are reqquired to make this SIMM? How many address lines does the SIMM require? How should the DRAMs Be connected ?

When talking about economics and the history of it for the

When talking about Economics and the history of it. For the past recessions the U.S. has had, do we look at it mostly on the loan side of the banks or what causes most recessions?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As