Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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 hers 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

11. Identify the stage of beyond duality in Gone With the Wind.

Answered: 1 week ago

Question

2. What is the business value of security and control?

Answered: 1 week ago