For this Question: Complete the Main class. Implement the getArea() and getPerimeter() methods for the child classes Parallelogram, Rhombus, Rectangle, and Square having Abstract class Quadrilateral as a parent class.


Do not change the name of any classThe first line of input contains side1, side2 and height of the parallelogram
The second line of input contains side and height of rhombus
The third line of input contains length and height of the rectangle
The fourth line of input contains side of square

If the length of any side or height for any shape is negative, then print <b><i>Length of a side cannot be negative. Please Enter a positive integer.</b></i>"Perimeter of Parallelogram is " + parallelogram.getPerimeter() +" and Area of Parallelogram is " + parallelogram.getArea()
"Perimeter of Rhombus is " + rhombus.getPerimeter() +" and Area of Rhombus is " + rhombus.getArea()
"Perimeter of Rectangle is " + rectangle.getPerimeter() +" and Area of Rectangle is " + rectangle.getArea()
"Perimeter of Square is " + square.getPerimeter()+ " and Area of Square is " + square.getArea()



Sample Input 1:
1.0 2.0 3.0 
7.0 5.0 
4.0 2.0
6.0

Sample Output 2:
Perimeter of Parallelogram is 6.0 and Area of Parallelogram is 3.0

Perimeter of Rhombus is 28.0 and Area of Rhombus is 35.0

Perimeter of Rectangle is 12.0 and Area of Rectangle is 8.0

Perimeter of Square is 24.0 and Area of Square is 36.0


Sample Input 2:
3.0 9.0 7.0 
6.0 4.0 
-1.0 5.0
8.0

Sample Output 2:
Length of a side cannot be negative. Please Enter a positive integer









, I have written this Solution Code: from abc import ABC, abstractmethod


class Quadrilateral(ABC):
    def __init__(self, side1, side2, side3, side4):
        self.side1, self.side2, self.side3, self.side4 = side1, side2, side3, side4

    @abstractmethod
    def getArea(self):
        pass

    def getPerimeter(self):
        return (self.side1+self.side2+self.side3+self.side4)


class Parallelogram(Quadrilateral):
    def __init__(self, side1, side2, height):
        super().__init__(side1, side2, side1, side2)
        self.heightPerpendicularToSide1 = height

    def getArea(self):
        return self.side1*self.heightPerpendicularToSide1


class Rhombus(Parallelogram):
    def __init__(self, side, height):
        super().__init__(side, side, height)


class Rectangle(Parallelogram):
    def __init__(self, length, breadth):
        super().__init__(length, breadth, breadth)


class Square(Rhombus):
    def __init__(self, side):
        super().__init__(side, side)


def main():
    # Parallelogram
    side1, side2, height = map(float, input().split())
    # side1 = float(input())
    # side2 = float(input())
    # height = float(input())
    parallelogram = Parallelogram(side1, side2, height)

    # Rhombus
    side, heightOfRhombus = map(float, input().split())
    # side = float(input())
    # heightOfRhombus = float(input())
    rhombus = Rhombus(side, heightOfRhombus)

    # Rectangle
    length, breadth = map(float, input().split())
    # length = float(input())
    # breadth = float(input())
    rectangle = Rectangle(length, breadth)

    # Square
    sideOfSquare = float(input())
    square = Square(sideOfSquare)

    if(side1 < 0 or side2 < 0 or heightOfRhombus < 0 or height < 0 or side < 0 or length < 0 or breadth < 0 or sideOfSquare < 0):
        print("Length of a side cannot be negative. Please Enter a positive integer")
        return

    print("Perimeter of Parallelogram is",
          parallelogram.getPerimeter(), "and Area of Parallelogram is", parallelogram.getArea())
    print("Perimeter of Rhombus is",
          rhombus.getPerimeter(), "and Area of Rhombus is", rhombus.getArea())
    print("Perimeter of Rectangle is",
          rectangle.getPerimeter(), "and Area of Rectangle is", rectangle.getArea())
    print("Perimeter of Square is",
          square.getPerimeter(), "and Area of Square is", square.getArea())


if __name__ == "__main__":
    main()
, In this Programming Language: Python, Now tell me if this Code is compilable or not?