Home /
Expert Answers /
Computer Science /
5-15-lab-javascript-superhero-and-supervillain-classes-in-this-lab-you-will-create-two-javascrip-pa695
(Solved):
5.15 LAB: JavaScript SuperHero and SuperVillain classes In this lab, you will create two JavaScrip ...
5.15 LAB: JavaScript SuperHero and SuperVillain classes In this lab, you will create two JavaScript classes 50 a super hero and willain can battle, as 5 hown below. Super Heroes vs. Super Villains Select a hero: Select a villain: Winner: Mighty Woman! The given index.html file contains two drop-down widgets listing the names of super heroes and super willains. A paragraph with ID winner is empty but will display the winner of a battle between the selected hero and villain. Investigate the given Javascript The given hero.js script contains the following: - A Superhuman class with properties name and ponerlevel. - Two constants, heroes and villains, that contain a list of Superhero and Supervillain objects. - A registerhandlers() function registers change event handlers for the two drop-down widgets and does not need to be altered. - A selectionchanged() function that is called when a hero or villain is selected. selectionchanged() is onky partialky implemented Make modifications Make the following modifications: - Create SuperHero and Supervillain classes that extend the Superhuman class. Both classes should have a constructor that has name alias, and powerlevel parameters, and the constructor should call the parent class' constructor with the given name and powerlevel. - Add a battle() method to the Superhero class that has a Supervillain parameter. battle() should return true if the herós powerLevel is >= the villain's powerLevel, false otherwise. - Add an getevilchuckle() method to the Supervillain class that returns the string "Ha ha ha!". - Modify selectionchanged() to call the selected hero's battle() method, passing in the selected willain. Display the battle winner's alias in the winner paragraph. When the modifications are complete, the web page will show the winner between the selected hero and willain. \begin{tabular}{l|l} LAB & 5.15.1: LAB: JavaScript SuperHero and Supervillain classes \end{tabular} 0/10 Submission instructions Dawnluadable fiks and Upload your files below by dragging and dropping into the area or ohoosing a file on your hard drive.