JavaScript SuperHero and SuperVillain classes

Assignment Help Basic Computer Science
Reference no: EM133860433

Question

JavaScript SuperHero and SuperVillain classes

In this lab, you will create two JavaScript classes so a super hero and villain can battle, as shown below.

The given index.html file contains two drop-down widgets listing the names of super heroes and super villains. 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 powerLevel.

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 only partially 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 hero'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 villain. 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 villain.

Reference no: EM133860433

Questions Cloud

Forensic investigation on compromised linux server : You are conducting a forensic investigation on a compromised Linux server. The system logs contain important information about the activities
What are potential impacts on society : How is technology involved and what are the potential impacts on society? what is the controversy What is the controversy.
Forensic examination of MacBook : During a forensic examination of a MacBook, it is necessary to undelete files that a suspect tried to erase before the device was confiscated.
Improve the safety of existing function process : You have been tasked to improve the safety of an existing function process_list, which takes three arguments: a list of integers xx and two indices
JavaScript SuperHero and SuperVillain classes : The given index.html file contains two drop-down widgets listing the names of super heroes and super villains.
Error an error occurred after the end of your code : Error An error occurred after the end of your code. One possible reason is that you have an unclosed parenthesis or string.
Describe the process of creating virtual machine : Describe the process of creating a virtual machine using Bash and Azure CLI. Which method of creating a virtual machine is easier,
Created to generate two PowerShell events : Use the Vm machines you created to generate 2 PowerShell events(403 and 600) and 8 security events
Create program with PHP code : Create program with PHP code that includes a numeric variable that stores a value from 1 to 12, using the "switch" control.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd