diff --git a/main.js b/main.js index afa4c17..94fe1d1 100644 --- a/main.js +++ b/main.js @@ -3,18 +3,40 @@ const assert = require('assert'); // This is an object that has types of jobs and the values each provide. const jobTypes = { - pilot: 'MAV', + pilot: 'MAV', mechanic: 'Repair Ship', commander: 'Main Ship', programmer: 'Any Ship!' }; -// Your code will go here - - - - +class CrewMember { + constructor(name, job, specialSkill, ship) { + this.name = name + this.job = job + this.specialSkill = specialSkill + this.ship = ship + } + enterShip(newShip) { + this.ship = newShip + newShip.crew.push(this) + } +} +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 + } + } +} // Begin by reading the tests and building a function that will full each one. @@ -60,6 +82,8 @@ if (typeof describe === 'function'){ assert.equal(mav.missionStatement(), "Can't perform a mission yet."); assert.equal(hermes.missionStatement(), "Can't perform a mission yet."); + + crewMember1.enterShip(mav); assert.equal(mav.missionStatement(), "Ascend into low orbit");