qberik

Untitled

Nov 17th, 2022
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1.  
  2. class Factory:
  3. def __init__( self, x, y ):
  4. self.x = x
  5. self.y = y
  6.  
  7. def getlocation( self ):
  8. print( "x =", self.x )
  9. print( "y =", self.y )
  10.  
  11.  
  12. class Employee( Factory ):
  13. def __init__(self, x, y):
  14. super().__init__( x, y )
  15.  
  16. def ChangePosition( self, x, y ):
  17. self.x = x
  18. self.y = y
  19.  
  20. def departament( self ):
  21. print( "this employee in sales department" )
  22.  
  23.  
  24. f = Factory( 2, 2 )
  25. e = Employee( 5, 5 )
  26.  
  27. e.ChangePosition( 5, 6 )
  28. print("Factory")
  29. f.getlocation()
  30. print("Employee")
  31. e.getlocation()
  32. e.departament()
  33.  
  34.  
  35. speed = 5
  36.  
  37. distance = ( (e.x-f.x)**2 + (e.y-f.y)**2 )**(1/2)
  38.  
  39. print( "Distance between Factory and Employee", distance )
  40.  
  41. print("Time is", distance / speed, "minutes" )
  42.  
  43.  
  44.  
Advertisement
Add Comment
Please, Sign In to add comment