Given an integer N, create an Abstract class Shape with an abstract method printArea that accepts integer
Fantastic news! We've Found the answer you've been seeking!
Question:
Given an integer N, create an Abstract class “Shape” with an abstract method “printArea” that accepts integer parameter and has return type void.
Also, create a “Square” class inherited from “Shape” class which implements a “printArea” method to print the area of the square (Area of Square = N2).
Input
50
Output
2500
Assume that,
- N is an integer within the range [1 to 1000000].
import java.util.*;
public class Solution {
public static void main(String[] args) {
//Write your code here
}
}
Related Book For
Posted Date: