Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Factory:
- def __init__( self, x, y ):
- self.x = x
- self.y = y
- def getlocation( self ):
- print( "x =", self.x )
- print( "y =", self.y )
- class Employee( Factory ):
- def __init__(self, x, y):
- super().__init__( x, y )
- def ChangePosition( self, x, y ):
- self.x = x
- self.y = y
- def departament( self ):
- print( "this employee in sales department" )
- f = Factory( 2, 2 )
- e = Employee( 5, 5 )
- e.ChangePosition( 5, 6 )
- print("Factory")
- f.getlocation()
- print("Employee")
- e.getlocation()
- e.departament()
- speed = 5
- distance = ( (e.x-f.x)**2 + (e.y-f.y)**2 )**(1/2)
- print( "Distance between Factory and Employee", distance )
- print("Time is", distance / speed, "minutes" )
Advertisement
Add Comment
Please, Sign In to add comment