Advertisement
divanov94

Untitled

Dec 9th, 2020
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Vacation{
  2.     constructor(organizer,destination,budget){
  3.         this.organizer=organizer;
  4.         this.destination=destination;
  5.         this.budget=budget;
  6.         this.kids={};
  7.     }
  8.  
  9.     registerChild(name,grade,budget){
  10.         let kid={
  11.             [grade]:[name,budget]
  12.         }
  13.         Object.keys(kid).forEach(k=>{
  14.             let currentGrade=k;
  15.             let [currentName,currentBudget]=kid[k]
  16.             if(currentBudget<this.budget){
  17.                 return `${currentName}'s money is not enough to go on vacation to {destination}.`
  18.            }
  19.  
  20.  
  21.  
  22.        })
  23.  
  24.  
  25.    }
  26.  
  27.    removeChild(name,grade){
  28.  
  29.    }
  30.  
  31.    toString(){
  32.  
  33.    }
  34.  
  35.    numberOfChildren(){
  36.  
  37.    }
  38. }
  39.  
  40.  
  41.  
  42. let vacation = new Vacation('Mr Pesho', 'San diego', 2000);
  43. console.log(vacation.registerChild('Gosho', 5, 2000));
  44. console.log(vacation.registerChild('Lilly', 6, 2100));
  45. console.log(vacation.registerChild('Pesho', 6, 2400));
  46. console.log(vacation.registerChild('Gosho', 5, 2000));
  47. console.log(vacation.registerChild('Tanya', 5, 6000));
  48. console.log(vacation.registerChild('Mitko', 10, 1590));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement