Question
a BlueJ Project. class name Calculator. In main method make an object of the subclass CalculationOption. Declare two variables and initialize with some value in
a BlueJ Project.
class name Calculator. In main method make an object of the subclass CalculationOption. Declare two variables and initialize with some value in main method. Make the template class called CalculationOption. In that class declare two integer variables. Initialize the variable through default constructor. Make the parameterized constructor to set the value from the main class. The subclass should use the required variables from sub class. Sum and subtraction method should be non-static while product and division should be public static methods which returns double datatype. The methods are sum, subtraction, product and division. Call the methods from the main class directly in print statement and display result and completely show the use of static and non-static method.
Sample is if the two variables value are 5 and 5 then
The sum is: 10
The subtraction is: 0
The product is: 25
The division is: 1
java class called PerimeterCalc.Within its main method, construct a Rectangle object, initialized with the arguments listed in the table below.Then calculate and print out the perimeter of the rectangle.Use the Rectangle class accessor methods to access the necessary values stored in the Rectangle object you created.The perimeter of a rectangle = 2 * (width + height).Your output should look like this:
java.awt.Rectangle[x=10,y=48,width=10,height=15]
The perimeter of this rectangle is: 50.0
Test this program with the following values.
Variable
Test Value
X
10
Y
48
Width
10
Height
15
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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