Computer Science, asked by sandhyal19, 3 months ago


Implement the following (15 Marks)
a. Create an Abstract class called BinaryOperation, which has two operands, one
operator. (example: "4+ 5" the operands: 4,5 and operator: '+')
b. Create abstract methods 'int compute (void)' and 'void printresult (void)' in
BinaryOperation. Also create necessary attributes, etc.
Create 4 classes extending this abstract class namely: AddBinaryOperation,
SubBinaryOperation, MulBinaryOperation and DivBinaryOperation, which does
addition, subtraction, multiplication, and division in the compute method.
d. Create another class called 'Binary EquationParser' which has a static method with
signature 'BinaryOperation parseBinaryOpString (String binOpString)"
i. This method parses the user input which is a string like "4+5" and then it
creates the appropriate instance (in this case AddBinaryOperation) and
populates operands, operator, etc. It returns the instance.
Create another class called 'BinaryMain' which only has the main method.
i. Take user input like "4 + 5” and print the result. In this case, the result is 9.
ii. In main method, you will make a call ONLY to the parseBinaryOpString in th
e.​

Answers

Answered by goughmary474
1

Answer:

intern outup 4 ++gc++df++

Similar questions
Math, 3 months ago