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

  User defined function to calculate average of three scores

A user defined function that will calculate and display the average of the 3 scores that remain after dropping the highest and lowest scores the performer received.

  Write program to list all english-math and science teachers

Suppose that input consists of a file of teachers. You are told to write a program to list all English, math, and science teachers. Each teacher can teach only one subject.

  Program to read from an input file

Write a program to read from an input file for 15 students, that contains each individual student ID, the course code, letter grade, and credit hours for five courses.

  Distinguish class templates and program with heading

Clearly distinguish each class templates and their program with heading. Elaborate each step and give it without errors. Develop classes or class templates for the following.

  Program for insertion sort and selection sort algorithms

Write a program involving the insertion sort, merge sort and selection sort algorithms.

  Write a full program to convert seconds into hours

Write a full program (starting from #include) that takes as input the number of seconds after midnight and displays the time in hours.

  Writing application to accept loan amount-interest rate

Write down the application to accept a loan amount, annual interest rate, and loan period (in number of years) and displays a table with five columns.

  Create the logic for a program which merges two files

Create the logic for a program which merges the two files into one file containing list of all students in district, maintaining student id number order.

  Application to print the sum of cubes

Write down the application to print the sum of cubes. Prompt for and read two integer values and print sum of each value raised to third power.

  Describe how to create users for sales organization unit

Describe how you would create users for sales organization unit and how you can set up user groups in this particular situation (global, universal, domain local).

  Write program to accept a list of student-s name

Write a program that will accepts a list of student's name, individual scores for quiz1, quiz2 and quiz3. Your program should then compute for the average of 3 quizzes.

  Implement ref integ result in data duplication

Would failure to implement Ref Integ result in data duplication, incorrect data sets, or broken table errors or is there a work around.

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