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
37 changes: 36 additions & 1 deletion 05week/spaceTravelToMars.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should make a instance of the crewMember and the Ship,
Then have them enter the ship.

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