From 1bc19f9777a62c91d2e06fe70462a4c63be3a075 Mon Sep 17 00:00:00 2001 From: anniebaker Date: Sun, 5 May 2019 17:11:41 -0500 Subject: [PATCH] Mars Mission --- 05week/spaceTravelToMars.js | 42 ++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/05week/spaceTravelToMars.js b/05week/spaceTravelToMars.js index ce258a382..5eaac9ebf 100644 --- a/05week/spaceTravelToMars.js +++ b/05week/spaceTravelToMars.js @@ -9,7 +9,47 @@ let jobTypes = { programmer: 'Any Ship!' }; -// Your code here +class Ship { + constructor(shipName, segment, ability){ + this.name = shipName; + this.type = segment; + this.ability = ability; + this.crew = []; + } + missionStatement() { + if (this.crew.length === 0) { + return "Can't perform a mission yet." + } else { + return this.ability; + } + } +} + + // if (this.crew.length > 1) { + // return 'Ascend into low orbit'; + // } else if (this.crew.length == 1) { + // return "Interplanetary Space Travel"; + // } else { + // return "Can't perform a mission yet."; + // } + // } +//} +// const Serenity = new Ship('Serenity', 'MAV', 'Ascend into low orbit'); +// console.log(Serenity); + +class CrewMember { + constructor(name, job, specialSkill){ + this.name = name; + this.job = job; + this.specialSkill = specialSkill; + } + enterShip(ship){ + this.ship = ship; + ship.crew.push(this); + } + } + +// const Rick = new CrewMember('Rick Martinez', 'pilot', 'chemistry'); //tests if (typeof describe === 'function'){