Javascript Create an object, Gremlin, that extends the Monster interface and takes the same argument language.
Javascript Create an object, Gremlin, that extends the Monster interface and takes the same argument language.
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 10PE
Related questions
Question
Javascript
Create an object, Gremlin, that extends the Monster interface and takes the same argument language.
- Gremlins inherits how a monster eats.
- Gremlins speaks differently. Gremlins replace each word in a sentence with its only known language, "gar". For example, if the sentence is "I like chicken", the speak() method will turn it into "gar gar gar".
class Monster {
constructor(language){
this.language = language;
this.stomach = Array();
}
// takes a food_item STRING and returns everything eaten so far ARRAY
eat(food_item) {
this.stomach.push(food_item);
}
// takes in a sentence STRING and returns the passed in sentence STRING with no change
speak(sentence) {
returnsentence;
}
}
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 4 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,