Draw and implement abstract base class

Assignment Help Programming Languages
Reference no: EM1371831

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 example, 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).

4. Implement a class RandomCalculations which creates a random number of random expressions and uses your classes above to evaluate and display them. Test its functionality by calling its methods in the CalculatorTest class above.

Reference no: EM1371831

Questions Cloud

Determine the best course of action : A European consortium has spent a considerable value of time and money making a new supersonic aircraft. The aircraft gets high marks on all performance measures except noise.
Fast food restaurant production function : I believe that fast food restaurants show short run production function because of the one fixed input, capital. But, I need to elaborate more and produce the production function equation Q=F (L,K,M...) Can you please help?
Explain llc and mac : Explain two layers: LLC & MAC, and how are they different from what is available in TCP/IP protocol? Why do we require these two extra layers for LAN?
Calculate firm profit : Suppose you are the manager of a company that produces products X and Y at zero cost. You know that different types of consumers value your two products differently,
Draw and implement abstract base class : Draw and implement the abstract base class ArithmeticExpression which represent any binary (having two arguments) arithmetic expression.
Determine the optimal package price : The American Baker's Association reports that yearly sales of bakery goods last year rose 15%, driven by a 50% increase in the demand for bran muffins
Determining fixed-marginal and average costs : Consider a firm with total short-run cost function C=a+b.Q. New legislation means that it should pay an environmental tax which is the fixed sum, independent of whether it produces any output.
Calculate time weighted rate of return : A portfolio manager is being evaluated based on the time-weighted average rate of return. If the manager had achieved annual returns for the past three years of 2.5 percent, 14.5 percent and 9 percent on one initial investment of $500,000,
Draw an erd for initial entity list : Draw an ERD for initial entity list. Recognize a primary key for each entity and establish relationships as appropriate. Entity list for this purpose is as follows.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd