From 07f5407ab60f1692c9ae556d000d533b76577711 Mon Sep 17 00:00:00 2001 From: Ashley U Date: Wed, 5 May 2021 09:16:56 -0500 Subject: [PATCH 1/9] Adding files for setup --- myPractice/index.html | 9 +++++++++ myPractice/myApp.js | 0 2 files changed, 9 insertions(+) create mode 100644 myPractice/index.html create mode 100644 myPractice/myApp.js diff --git a/myPractice/index.html b/myPractice/index.html new file mode 100644 index 0000000..ba40494 --- /dev/null +++ b/myPractice/index.html @@ -0,0 +1,9 @@ + + + + + + + Please use the developer console to verify that your classes are working properly. + + \ No newline at end of file diff --git a/myPractice/myApp.js b/myPractice/myApp.js new file mode 100644 index 0000000..e69de29 From 9a3337f1f1785a538cc89115bd2f733b2ab65760 Mon Sep 17 00:00:00 2001 From: Ashley U Date: Wed, 5 May 2021 09:29:24 -0500 Subject: [PATCH 2/9] Adding Person class --- myPractice/myApp.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/myPractice/myApp.js b/myPractice/myApp.js index e69de29..75d1c57 100644 --- a/myPractice/myApp.js +++ b/myPractice/myApp.js @@ -0,0 +1,10 @@ +class Person() { + constructor() { + this.name = name; + this.age = age; + this.numBooksRead = numBooksRead; + } + readNewBook() { + this.numBooksRead++; + } +} \ No newline at end of file From 502b26a8bb0af53661d1782fe52bb854651300ea Mon Sep 17 00:00:00 2001 From: Ashley U Date: Wed, 5 May 2021 09:36:06 -0500 Subject: [PATCH 3/9] Adding Dev and Cook classes --- myPractice/myApp.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/myPractice/myApp.js b/myPractice/myApp.js index 75d1c57..3d8d6cd 100644 --- a/myPractice/myApp.js +++ b/myPractice/myApp.js @@ -1,5 +1,5 @@ class Person() { - constructor() { + constructor(name, age, numBooksRead) { this.name = name; this.age = age; this.numBooksRead = numBooksRead; @@ -7,4 +7,26 @@ class Person() { readNewBook() { this.numBooksRead++; } +} + +class Developer extends Person { + constructor(name, age, numBooksRead) { + super(name, age, numBooksRead); + this.numKnownProgrammingLang = numKnownProgrammingLang; + } +} + +class Cook extends Person { + constructor(name, age, numBooksRead) { + super(name, age, numBooksRead); + this.isHungry = isHungry; + } + + eat () { + if(this.isHungry) { + this.isHungry = false; + } else { + console.log("Ugh, I'm so full."); + } + } } \ No newline at end of file From 44cc9f8dc613b3377f8b80f9f9383923a9286d9d Mon Sep 17 00:00:00 2001 From: Ashley U Date: Wed, 5 May 2021 09:41:38 -0500 Subject: [PATCH 4/9] Updating Method --- myPractice/myApp.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/myPractice/myApp.js b/myPractice/myApp.js index 3d8d6cd..e68638f 100644 --- a/myPractice/myApp.js +++ b/myPractice/myApp.js @@ -19,14 +19,15 @@ class Developer extends Person { class Cook extends Person { constructor(name, age, numBooksRead) { super(name, age, numBooksRead); - this.isHungry = isHungry; + this.burnedFood = burnedFood; } - eat () { - if(this.isHungry) { - this.isHungry = false; + burnedFood () { + if(this.burnedFood) { + this.burnedFood = false; } else { - console.log("Ugh, I'm so full."); + console.log("Ugh! I burnt the food!"); } } -} \ No newline at end of file +} + From e6e1f36399b1452627941813ad607360c1b8f6b2 Mon Sep 17 00:00:00 2001 From: Ashley U Date: Wed, 5 May 2021 09:43:54 -0500 Subject: [PATCH 5/9] Adding variables --- myPractice/myApp.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/myPractice/myApp.js b/myPractice/myApp.js index e68638f..46ea627 100644 --- a/myPractice/myApp.js +++ b/myPractice/myApp.js @@ -31,3 +31,11 @@ class Cook extends Person { } } +let person = new Person('Alyssa', 22, 10); +let developer = new Developer('Ashley', 30, 3, ['JavaScript', 'JAVA']); +let cook = new Cook('Persius', 16, 5, true); + +//log each instance +console.log(person); +console.log(developer); +console.log(cook); \ No newline at end of file From 1303d194d44cb9d20139bc681027027ddb3bd3f7 Mon Sep 17 00:00:00 2001 From: Ashley U Date: Wed, 5 May 2021 09:44:29 -0500 Subject: [PATCH 6/9] Fixing bug --- myPractice/myApp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/myPractice/myApp.js b/myPractice/myApp.js index 46ea627..292d59f 100644 --- a/myPractice/myApp.js +++ b/myPractice/myApp.js @@ -1,4 +1,4 @@ -class Person() { +class Person { constructor(name, age, numBooksRead) { this.name = name; this.age = age; From 122349a06efa8a7a07119921a29b9bc3ab7b63a8 Mon Sep 17 00:00:00 2001 From: Ashley U Date: Wed, 5 May 2021 09:45:48 -0500 Subject: [PATCH 7/9] Fixing bugs --- myPractice/myApp.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/myPractice/myApp.js b/myPractice/myApp.js index 292d59f..8e52ef0 100644 --- a/myPractice/myApp.js +++ b/myPractice/myApp.js @@ -10,14 +10,14 @@ class Person { } class Developer extends Person { - constructor(name, age, numBooksRead) { + constructor(name, age, numBooksRead, numKnownProgrammingLang) { super(name, age, numBooksRead); this.numKnownProgrammingLang = numKnownProgrammingLang; } } class Cook extends Person { - constructor(name, age, numBooksRead) { + constructor(name, age, numBooksRead, burnedFood) { super(name, age, numBooksRead); this.burnedFood = burnedFood; } From 2b7a1af1a7353b641800fe8dd6519553afeeb192 Mon Sep 17 00:00:00 2001 From: Ashley U Date: Wed, 5 May 2021 09:46:46 -0500 Subject: [PATCH 8/9] Adding cook --- myPractice/myApp.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/myPractice/myApp.js b/myPractice/myApp.js index 8e52ef0..dfbeef1 100644 --- a/myPractice/myApp.js +++ b/myPractice/myApp.js @@ -32,8 +32,8 @@ class Cook extends Person { } let person = new Person('Alyssa', 22, 10); -let developer = new Developer('Ashley', 30, 3, ['JavaScript', 'JAVA']); -let cook = new Cook('Persius', 16, 5, true); +let developer = new Developer('Ashley', 30, 5, ['JavaScript', 'JAVA']); +let cook = new Cook('Baylor', 26, 15, true); //log each instance console.log(person); From 8d07b017cf4bd746b2e04c62a8c0c559db20e28d Mon Sep 17 00:00:00 2001 From: Ashley U Date: Wed, 5 May 2021 09:59:17 -0500 Subject: [PATCH 9/9] Adding function calls for burning the food --- myPractice/myApp.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/myPractice/myApp.js b/myPractice/myApp.js index dfbeef1..a08ed83 100644 --- a/myPractice/myApp.js +++ b/myPractice/myApp.js @@ -22,7 +22,7 @@ class Cook extends Person { this.burnedFood = burnedFood; } - burnedFood () { + burnt() { if(this.burnedFood) { this.burnedFood = false; } else { @@ -35,7 +35,20 @@ let person = new Person('Alyssa', 22, 10); let developer = new Developer('Ashley', 30, 5, ['JavaScript', 'JAVA']); let cook = new Cook('Baylor', 26, 15, true); -//log each instance console.log(person); console.log(developer); -console.log(cook); \ No newline at end of file +console.log(cook); + +person.readNewBook(); +developer.readNewBook(); +cook.readNewBook(); + +console.log(person); +console.log(developer); +console.log(cook); + +cook.burnt(); + +console.log(cook); + +cook.burnt(); \ No newline at end of file