diff --git a/main.js b/main.js index afa4c17..d0ed0a2 100644 --- a/main.js +++ b/main.js @@ -11,9 +11,49 @@ const jobTypes = { // Your code will go here +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 "Can't perform a mission yet."; + } + else if (this.crew.length !== 0 && this.name === 'Mars Ascent Vehicle') { + return "Ascend into low orbit" + } + else if (this.crew.length !== 0 && this.name === 'Hermes') + return "Interplanetary Space Travel" + } +} + +class CrewMember { + constructor(name, job, specialSkill, ship) { + this.name = name; + this.job = job; + this.specialSkill = specialSkill; + this.ship = null; + } + enterShip = (ship) => { + this.ship = ship; + this.ship.crew.push(this); + } +} +// let mav = new Ship('Mars Ascent Vehicle', 'MAV', 'Ascend into low orbit'); +// console.log(mav); +// let hermes = new Ship('Hermes', 'Main Ship', 'Interplanetary Space Travel'); +// console.log(hermes); +// const crewMember1 = new CrewMember ('Rick Martinez', 'pilot', 'chemistry', null); +// console.log(crewMember1) + +// const crewMember2 = new CrewMember('Commander Lewis', 'commander', 'geology'); +// console.log(crewMember2) @@ -67,4 +107,4 @@ if (typeof describe === 'function'){ assert.equal(hermes.missionStatement(), "Interplanetary Space Travel"); }); }); -} +} \ No newline at end of file