From 203bd3d5c501c2978ec989a26c85f576713b1839 Mon Sep 17 00:00:00 2001 From: uhuru3 Date: Thu, 15 Nov 2018 18:30:59 -0800 Subject: [PATCH] travel to mars completed --- 05week/spaceTravelToMars.js | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/05week/spaceTravelToMars.js b/05week/spaceTravelToMars.js index ce258a382..f411c0e71 100644 --- a/05week/spaceTravelToMars.js +++ b/05week/spaceTravelToMars.js @@ -10,6 +10,52 @@ let jobTypes = { }; // Your code here +class CrewMember { + constructor(name, job, specialSkill){ + this.name = name; + this.job = job; + this.specialSkill = specialSkill; + this.ship = null; + } + + // printOutName(){ + // console.log(this.name) + // } + + enterShip(ship){ + this.ship = ship; + ship.crew.push(this) + } + +// assignToGenere(ship.emptyCrew){ +// this.ship.emptyCrew = CrewMember.ship; +// ship.emptyCrew.push(this) +// } + +}; + +class Ship { + constructor(name, type, ability, crew){ + this.name = name, + this.type = type, + this.ability = ability, + this.crew = [] + } + + missionStatement(){ + if(this.crew.length > 0 ){ + return this.ability; + }else{ + return "Can't perform a mission yet." + } + } +}; + +const crewMember1 = new CrewMember('Rick Martinez', 'pilot', 'chemistry'); +const crewMember2 = new CrewMember('Commander Lewis', 'commander', 'geology'); + +const mav = new Ship('Mars Ascent Vehicle', 'MAV', 'Ascend into low orbit'); +const hermes = new Ship('Hermes', 'Main Ship', 'Interplanetary Space Travel'); //tests if (typeof describe === 'function'){