Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 47 additions & 1 deletion 05week/spaceTravelToMars.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,53 @@ let jobTypes = {
programmer: 'Any Ship!'
};

// Your code here
/**************************WHITE BOARD NOTES *************************
// CrewMember
// 1) should have a name, a job, a specialSkill and ship upon instantiation
// 2) can enter a ship
//
// Ship
// 3) should have a name, a type, an ability and an empty crew upon instantiation
// 4) can return a mission statement correctly
//
// 1) CrewMember should have a name, a job, a specialSkill and ship upon instantiation:
//
// 2) CrewMember can enter a ship:
//
// 3) Ship should have a name, a type, an ability and an empty crew upon instantiation:
//
// 4) Ship can return a mission statement correctly:
*******************************************************************************/

class CrewMember {
constructor(name, job, specialSkill, ship) {
this.name = name;
this.job = job;
this.specialSkill = specialSkill;
this.ship = null;
}
enterShip(leShip) {
console.log(this.name);
leShip.crew.push(this);
this.ship = leShip;
}
}

class Ship {
constructor(name, type, ability) {
this.name = name;
this.type = type;
this.ability = ability;
this.crew = [];
}
missionStatement() {
if (this.crew.length) {
return this.ability;
} else {
return "Can't perform a mission yet.";
}
}
}

//tests
if (typeof describe === 'function'){
Expand Down