Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Vacation{
- constructor(organizer,destination,budget){
- this.organizer=organizer;
- this.destination=destination;
- this.budget=budget;
- this.kids={};
- }
- registerChild(name,grade,budget){
- let kid={
- [grade]:[name,budget]
- }
- Object.keys(kid).forEach(k=>{
- let currentGrade=k;
- let [currentName,currentBudget]=kid[k]
- if(currentBudget<this.budget){
- return `${currentName}'s money is not enough to go on vacation to {destination}.`
- }
- })
- }
- removeChild(name,grade){
- }
- toString(){
- }
- numberOfChildren(){
- }
- }
- let vacation = new Vacation('Mr Pesho', 'San diego', 2000);
- console.log(vacation.registerChild('Gosho', 5, 2000));
- console.log(vacation.registerChild('Lilly', 6, 2100));
- console.log(vacation.registerChild('Pesho', 6, 2400));
- console.log(vacation.registerChild('Gosho', 5, 2000));
- console.log(vacation.registerChild('Tanya', 5, 6000));
- console.log(vacation.registerChild('Mitko', 10, 1590));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement