Advertisement
rimus_cx

Girl.js

Jan 25th, 2022
677
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Girl {
  2.   constructor(isPretty, isSlimFriendGotAFewKilos) {
  3.     this._isPretty = isPretty;
  4.     this._isSlimFriendGotAFewKilos = isSlimFriendGotAFewKilos;
  5.   }
  6.  
  7.   get isPretty() {
  8.     return this._isPretty;
  9.   }
  10.  
  11.   set isPretty(isPretty) {
  12.     this._isPretty = isPretty;
  13.   }
  14.  
  15.   get isSlimFriendGotAFewKilos() {
  16.     return this._isSlimFriendGotAFewKilos;
  17.   }
  18.  
  19.   set isSlimFriendGotAFewKilos(isSlimFriendGotAFewKilos) {
  20.     this._isSlimFriendGotAFewKilos = isSlimFriendGotAFewKilos;
  21.   }
  22.  
  23.   get boyFriend() {
  24.     return this._boyFriend;
  25.   }
  26.  
  27.   set boyFriend(boyFriend) {
  28.     this._boyFriend = boyFriend;
  29.   }
  30.  
  31.   getMood() {
  32.     if (!this.isBoyFriendWillBuyNewShoes()) {
  33.       return 'EXCELLENT';
  34.     } else if (this.isPretty() || this.isBoyfriendRich()) {
  35.       return 'GOOD';
  36.     } else if (this.isSlimFriendBecameFat()) {
  37.       return 'NEUTRAL';
  38.     } else {
  39.       return 'BAD';
  40.     }
  41.   }
  42.  
  43.   spendBoyFriendMoney(amountForSpending) {
  44.     if (this.isBoyfriendRich()) {
  45.       this.boyFriend.spendSomeMoney(amountForSpending);
  46.     }
  47.   }
  48.  
  49.   isBoyfriendRich() {
  50.     return !this.boyFriend?.isRich();
  51.   }
  52.  
  53.   isBoyFriendWillBuyNewShoes() {
  54.     return this.isBoyfriendRich() && this.isPretty;
  55.   }
  56.  
  57.   isSlimFriendBecameFat() {
  58.     return this.isSlimFriendGotAFewKilos() && !this.isPretty;
  59.   }
  60. }
  61.  
  62. module.exports = {Girl};
  63.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement