Advertisement
avaglarov

Untitled

Dec 16th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. class Provider {
  2. constructor(name) {
  3. this.name = name;
  4. this.money = 2000;
  5. this.profit = 0;
  6. }
  7.  
  8. byGoods(good, quantity) {
  9. //kupuva stoka i si vzima 20%
  10. // sklada harchi pari
  11. // profita mu se uvelichava
  12. // uvelichavat se stokite vsklada
  13. }
  14. }
  15.  
  16. class Distributor {
  17. constructor(name) {
  18. this.name = name;
  19. this.profit = 0;
  20. }
  21.  
  22. daliverGoods(good, quantity) {
  23. //dostavq stoka i si vzima 20% komisionna
  24. // profota mu se uvelichava
  25. // sklada pacheli pari
  26. // namalqvat stokite v sklada
  27. }
  28. }
  29.  
  30. class Worker {
  31. constructor(name, salary) {
  32. this.name = name;
  33. this.salary =salary;
  34. this.acceptedGoods = [];
  35. this.signedOffGoods = [];
  36. }
  37.  
  38. arrangeGoods(good) {
  39. //ako e priemane: dobavq v prietite stoki i dobavq v stokite v sklada
  40. //ako e otpisvane: dobavq v otpisanite stoki i izvajda ot stokite v sklada
  41. }
  42. }
  43.  
  44. class Good {
  45. constructor(name, price, quantity) {
  46. this.name = name;
  47. this.price = price;
  48. this.quantity = quantity;
  49. }
  50. }
  51.  
  52. class Storage {
  53. constructor(name, adress) {
  54. this.name = name;
  55. this.adress = adress;
  56. this.providers = [];
  57. this.workers = [];
  58. this.distributors = [];
  59. this.goods = [];
  60. this.oborot = 10000;
  61. }
  62.  
  63. availability(good) {
  64. if (this.goods.indexOf(good) !== -1) {
  65. if (good.quantity > 0) {
  66. console.log(good.quantity + ' left');
  67. } else {
  68. console.log('the storage run out of: ' + good.name);
  69. }
  70. } else {
  71. console.log('the storage run out of: ' + good.name);
  72. }
  73. }
  74.  
  75. loadTheStorage(ListOfGoods) {
  76. if (Math.random() > 0.5) {
  77. this.providers[0].name
  78. }
  79. }
  80. }
  81.  
  82. // var sklad1 = new Storage('sklad', 'bul. afsadf');
  83. // var vafli = new Good('vafli', 0.20, 0);
  84. // var shokolad = new Good('shokolad', 1.60, 6);
  85.  
  86. // sklad1.goods.push(vafli);
  87.  
  88. // sklad1.availability(shokolad);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement