Guest User

Untitled

a guest
Mar 17th, 2018
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1.  
  2. /balance <account> 400
  3. /overdraft <account> 100
  4. /savings-rate <account> 0.1
  5.  
  6. /balance <savings-account> 0
  7.  
  8. $ account.balance
  9. 400
  10.  
  11. /withdraw <account> 100
  12. -->
  13. /balance <savings-account> 10
  14. /balance <account> 290
  15.  
  16.  
  17. /withdraw <account> 300
  18. -->
  19. /balance <savings-account> 40
  20. /balance <account> -40
  21.  
  22. /withdraw <account> 100
  23. -->
  24. ! Insufficient Funds !
  25.  
  26. /withdraw <account> 60
  27. -->
  28. /balance <account> -100
  29. /balance <savings-account> 40
  30.  
  31. $ account.available-balance
  32. 60
  33.  
  34. --------------------------------------------------------------------------------
  35.  
  36. /available-balance= <account> _.balance + _.overdraft
  37.  
  38.  
  39. /reaction= <account.withdraw> (/balance= <account> _.available-balance - $input)
  40.  
  41. /reaction.before= <account.withdraw>
  42. ($input > 0) False:(Error("Don't you want any money?"))
  43.  
  44. /reaction.before= <account.withdraw>
  45. (_.available-balance > 0) False:(Error("You're broke"))
  46.  
  47. /reaction.before= <account.withdraw>
  48. ((_.available-balance - $input) > 0) False:(Error("Insufficient Funds"))
  49.  
  50. /reaction.after <account.withdraw>
  51. Let('savings', ($input * _.savings-rate));
  52. ((_.available-balance - savings) > 0)
  53. True: ((/balance= <savings-account> _.balance + savings);
  54. (/balance= <account> _.balance - savings))
  55.  
  56. --------------------------------------------------------------------------------
  57.  
  58. /left <rect> 0
  59. /top <rect> 0
  60. /width <rect> 40
  61. /height <rect> 10
  62.  
  63. /right= <rect> _.left + _.width
  64. /bottom= <rect> _.top + _.height
  65.  
  66. /repr= <rect> "Rectangle((%s, %s), (%s, %s))" % (_.left, _.top, _.right, _.bottom)
  67.  
  68. /width <rect> 17
  69.  
  70. $ rect.repr
  71. Rectangle(0, 0, 17, 10)
  72.  
  73. /left <rect> 25
  74.  
  75. $ rect.repr
  76. Rectangle(25, 0, 42, 10)
Add Comment
Please, Sign In to add comment