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
42 changes: 41 additions & 1 deletion 05week/spaceTravelToMars.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,47 @@ let jobTypes = {
programmer: 'Any Ship!'
};

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

// if (this.crew.length > 1) {
// return 'Ascend into low orbit';
// } else if (this.crew.length == 1) {
// return "Interplanetary Space Travel";
// } else {
// return "Can't perform a mission yet.";
// }
// }
//}
// const Serenity = new Ship('Serenity', 'MAV', 'Ascend into low orbit');
// console.log(Serenity);

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

// const Rick = new CrewMember('Rick Martinez', 'pilot', 'chemistry');

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