Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a) Given is the program name OurCalculation with class Calculation that perform the addition, subtraction. Using the keywords EXTEND in inheritance, rewrite the code

imageimage

a) Given is the program name OurCalculation with class Calculation that perform the addition, subtraction. Using the keywords EXTEND in inheritance, rewrite the code so that My Calculation will EXTEND the class Calculation and, In the class, My_Calculation perform the multiplication function. The main method should be modified to display the multiplication result. The output should look like this: The sum of the given numbers:30 The difference between the given numbers: 10 The multiplication of the given numbers:200 Program OurCalculation class Calculation { int z; ** public void addition (int x, int y) { z = x + y; System.out.println("The sum of the given numbers: "+z); } public void Subtraction (int x, int y) { } z = x - y; System.out.println ("The difference between the given } public class My_Calculation { public static void main (String args []) { int a = 20, b = 10; } numbers: "+z); } My_Calculation demo= new My_Calculation (); demo. addition (a, b); demo. Subtraction (a, b);

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Below is the modified code using the extends keyword in Java to implement inheritance The MyCalculat... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions