From 2beb75b3c1f66b7460413df98290daaf52c62e02 Mon Sep 17 00:00:00 2001 From: Chris Trevino Date: Tue, 24 Mar 2020 19:41:52 -0500 Subject: [PATCH 1/4] changes --- 01week/helloworld.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 01week/helloworld.js diff --git a/01week/helloworld.js b/01week/helloworld.js new file mode 100644 index 000000000..3ae23b3df --- /dev/null +++ b/01week/helloworld.js @@ -0,0 +1,3 @@ +node"use strict" + + console.log("Hello World!"); \ No newline at end of file From 3f482adfbd35066151f2223268150c73b8f13974 Mon Sep 17 00:00:00 2001 From: Chris Trevino Date: Tue, 24 Mar 2020 19:49:19 -0500 Subject: [PATCH 2/4] 1stprogram --- 01week/helloworld.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/01week/helloworld.js b/01week/helloworld.js index 3ae23b3df..8274abb6f 100644 --- a/01week/helloworld.js +++ b/01week/helloworld.js @@ -1,3 +1,3 @@ -node"use strict" +"use strict" console.log("Hello World!"); \ No newline at end of file From bc9224649b43674148ad06279bd107cbb2f69b78 Mon Sep 17 00:00:00 2001 From: Chris Trevino Date: Fri, 1 May 2020 23:27:51 -0500 Subject: [PATCH 3/4] updates --- 05week/spaceTravelToMars.js | 103 ++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/05week/spaceTravelToMars.js b/05week/spaceTravelToMars.js index ce258a382..d69a91d5b 100644 --- a/05week/spaceTravelToMars.js +++ b/05week/spaceTravelToMars.js @@ -10,6 +10,109 @@ let jobTypes = { }; // Your code here +class CrewMember { + constructor(name, job, specialSkill) { + this.name = name; + this.job = job; + this.specialSkill = specialSkill; + this.ship = null; + } + + //this method should add THIS crew member to the ship being passed in + //note: an entire ship instance is passed in, not just the name + //note: the entire crew member is added to the ships array of crew + description (){ + if(this.ship == null) { + return `${this.name} is a ${this.job} and isn't assign too a ship`; + } else { + return `${this.name} is a ${this.job} and is assign to ${this.ship}`; + } + + +} + + + + + +enterShip(ship) { + this.ship = ship; + ship.crew.push(this); + + //crewMember1.assignedShip = mav + //mav.crew.push(crewMember1); + +} +} + + + + + + + + +class Ship { + constructor(name, type, ability) { + this.name = name; + this.type = type; + this.ability = ability; + this.crew = []; + } +// this method should return the ship's ability if there is a crew member +// whose job matches up with the ship's type + + missionStatement() { + if(this.crew.length == 0 && this.crew.job == this.ship.ability) { + return this.ability; + } else { + return "Can't perform a mission yet." + } + + + } + +} +//created first crew member +let rick = new CrewMember('Rick Martinez', 'pilot', 'Ascend into low orbit'); +//console.log(crewMember1); +//created second crew member +let lewis = new CrewMember('Commander Lewis', 'commander', 'geology'); +//console.log(crewMember2) +//created third crew member +let chris = new CrewMember('Chris Trevino', 'programmer', 'geology'); +//created fourth crew member +let hitzel = new CrewMember('Hitzel Betts', 'mechanic', 'biology'); + +// ship one was created +let mav = new Ship('Mars Ascent Vehicle', 'MAV', 'Ascend into low orbit'); +//console.log(mav); +//ship two was created +let hermes = new Ship('Hermes', 'Main Ship', 'Interplanetary Space Travel'); +//console.log(hermes); +// console logged the input below to make sure mission statement works +// put crew members into ship +rick.enterShip(mav) +lewis.enterShip(hermes) +chris.enterShip(mav) +//console.log(mav.missionStatement()); + +//now need to test PUSH for adding a crew member to ship +//mav.crew.push(crewMember1); +// Testing the output with console log +console.log(mav.missionStatement()); +console.log(hermes.missionStatement()); +// Putting crewMember1 into MAV +//crewMember1.assignedShip = mav +// wanted to test the get in ship method +//console.log(crewMember1.description()); +// shows that crew member one isn't assigned to a ship..... yet +console.log(rick.description()); +//console.log(mav); + + + + //tests if (typeof describe === 'function'){ From f3a2fa492aeb884b03dd4b3d0fe5700c6f28aeb8 Mon Sep 17 00:00:00 2001 From: Chris Trevino Date: Sat, 2 May 2020 17:24:47 -0500 Subject: [PATCH 4/4] updated --- 05week/spaceTravelToMars.js | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/05week/spaceTravelToMars.js b/05week/spaceTravelToMars.js index d69a91d5b..12c0d82e8 100644 --- a/05week/spaceTravelToMars.js +++ b/05week/spaceTravelToMars.js @@ -11,7 +11,7 @@ let jobTypes = { // Your code here class CrewMember { - constructor(name, job, specialSkill) { + constructor(name, job, specialSkill,ship) { this.name = name; this.job = job; this.specialSkill = specialSkill; @@ -30,14 +30,10 @@ class CrewMember { } - - - - -enterShip(ship) { - this.ship = ship; - ship.crew.push(this); +enterShip(currentShip) { + this.ship = currentShip; + currentShip.crew.push(this); //crewMember1.assignedShip = mav //mav.crew.push(crewMember1); @@ -63,15 +59,17 @@ class Ship { // whose job matches up with the ship's type missionStatement() { - if(this.crew.length == 0 && this.crew.job == this.ship.ability) { - return this.ability; - } else { + // if the length of the crew is equal to zero + if(this.crew.length == 0) { + //then return cannot perfrom return "Can't perform a mission yet." - } - - - } + //now need to compare job vs ability + } else if (this.job == this.ability){ + //need to return it ability + return "this thing is working" + } +} } //created first crew member let rick = new CrewMember('Rick Martinez', 'pilot', 'Ascend into low orbit'); @@ -107,7 +105,7 @@ console.log(hermes.missionStatement()); // wanted to test the get in ship method //console.log(crewMember1.description()); // shows that crew member one isn't assigned to a ship..... yet -console.log(rick.description()); +//console.log(rick.description()); //console.log(mav);