Sep-18-2019, 07:38 PM
Thats ok ive managed to figure ropes around this thing
here is the result i came up with seems to work and prety happy with it if there is any improvements im open for sugestions :)
here is the result i came up with seems to work and prety happy with it if there is any improvements im open for sugestions :)
import math class Rectangle: # Init function def __init__(self, length, height, Point1x, Point1y, Point4x, Point4y): # The only members are length and width self.length = length self.height = height self.Point1x = Point1x self.Point1y = Point1y self.Point4x = Point4x self.Point4y = Point4y def findarea(self): return self.length * self.height def perimeter(self): return 2*(self.length+self.height) def diagonal(self): return (math.sqrt((self.length ** 2) + (self.height ** 2))) def center(self): return self.length / 2 , self.height / 2 def Point2(self): return self.Point4x - length, self.Point1y - height def Point3(self): return self.Point1x + length, self.Point4y + height print('Find area and perimeter of rectangle enter lenght and width values bellow: ') length=int(input('Please Enter the Length of a Rectangle: ')) height=int(input('Please Enter the Height of a Rectangle: ')) print('Input coordinates of your first point : ') Point1x=int(input('Please Enter the x coordinate of a Rectangle: ')) Point1y=int(input('Please Enter the y coordinate of a Rectangle: ')) Point4x= Point1x + length Point4y= Point1y - height r1=Rectangle(length, height, Point1x, Point1y, Point4x, Point4y) print('Area : ', r1.findarea()) print('Perimeter : ', r1.perimeter()) print('Diagonal : ', r1.diagonal()) print('Center of Rectangle : ', r1.center()) print ('Top Left corner point coordinates : %.f ' %Point1x,", %.f"%Point1y) print ('Top Right corner point coordinates : ', r1.Point2()) print ('Botoom Left corner point coordinates : ', r1.Point3()) print ('Botoom Right corner point coordinates : %.f ' %Point4x, " %.f"%Point4y)