From 5b8b1baf185ceb8196d31a99a58939aea94ba3f8 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 13 Nov 2018 17:04:39 -0600 Subject: [PATCH] finsihed mars --- 05week/spaceTravelToMars.js | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/05week/spaceTravelToMars.js b/05week/spaceTravelToMars.js index ce258a382..85dc207b0 100644 --- a/05week/spaceTravelToMars.js +++ b/05week/spaceTravelToMars.js @@ -9,7 +9,42 @@ let jobTypes = { programmer: 'Any Ship!' }; -// Your code here +// plan +//CrewMember and Ship are classes +//mission statement function check if at least one crew member on ship (check array empty). if yes return ,ission statement of ship, if no, Can't perform a mission yet +//enter ship function similar to transformers + + +class CrewMember { + constructor(name, job, specialSkill) { + this.name = name; + this.job = job; + this.specialSkill = specialSkill; + }; + + enterShip = (ship) => { + this.ship = ship; + ship.crew.push(this.name); + }; +} + +class Ship { + constructor(name, type, ability) { + this.name = name; + this.type = type; + this.ability = ability; + this.crew = []; + } + + missionStatement = () => { + if (this.crew.length == 0) { + return "Can't perform a mission yet."; + } else { + return this.ability; + } + } +} + //tests if (typeof describe === 'function'){