Java - Language Given the following definition of the class One: class One { private int x, y; public A(int x, int y) { this.x
Java - Language Given the following definition of the class One:
class One {
private int x, y;
public A(int x, int y) { this.x = x; this.y = y;}
public A() {this.a = 1; this.b = 1;}
public int f( int a) {return a*x*y;}
}
provide the definition of the class B that is derived from class A such that it would have:
a private integer data member called z.
a constructor that would take three integers parameters called x, y and z. The first two parameters are to be used to initialize the base class data members and the third parameter is to be used to initialize z.
a default constructor that would use the previous constructor to set all data members to 1.
an overridden version of the function f that would return a*x*y*z using the base class version of the function.
an overloaded version of f that would take two integers parameters called mand n and would return a*x*y*z*m*n.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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