Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first commit #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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 main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)



Expand Down Expand Up @@ -67,4 +107,4 @@ if (typeof describe === 'function'){
assert.equal(hermes.missionStatement(), "Interplanetary Space Travel");
});
});
}
}