Define a new class named Square and override the methods area() and perimeter() to calculate the area and perimeter of a square.
public class Rectangle {
private double width;
private double height;
Rectangle(double width, double height){
this.width = width;
this.height = height;
}
public double getWidth() {
return width;
}
public double getHeight() {
return height;
}
public void area() {
System.out.println("Area of Rectangle is: " + (width * height) ) ;
}
public void perimeter() {
System.out.println("Perimeter of Rectangle is: " + ( (2* width) +
(2* height) ) ) ;
}
}
Answers
Answered by
4
Answer:
varily wheather the x=l,-l are zeras of palynamial.x²-1
Similar questions