Question
Create an abstract class named Arithmetic. Include two fields to catch two different numbers (use set() and get() methods). Also include an abstract method named
Create an abstract class named Arithmetic. Include two fields to catch two different numbers (use set() and get() methods). Also include an abstract method named performOperation().
Create four child classes of Arithmetic: Add, Subtract, Multiply and Divide. Each must include a performOperation() method to perform the indicated operation (add, subtract, multiply, or divide) on the two numbers. Also include a display() method to show the desired result.
Write an application that catches two numbers from the user (Scanner or JOptionPane). Then create the four Arithmetic child objects to display all four results.
Save the files as Arithmetic.java, Add.java, Subtract.java, Multiply.java, Divide.java, and UseArithmetic.java
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started