Write a subclass evolvablecutecreature

Assignment Help JAVA Programming
Reference no: EM131604443

Inheritance

You use your code from Homework 2 to release your game, Super Happy Fun Cute Creatures World Traveler, to widespread acclaim. Unfortunately, within only a few months of release your player base is getting restless! They are easily bored and are demanding that you add more depth to the game.

In response, you decide to introduce a new breed of CuteCreatures into your game world. These creatures will automatically "evolve" once they reach level 20. (Not every creature can evolve - some will stay in their original form no matter how high they level.) Evolved creatures are similar to regular creatures, but they gain the following extras:

• When the creature evolves, it gains a one-time bonus of 15 maximum and current hit points and 5 attackdamage. This is on top of the regular gains fromleveling.

• Each evolved creature becomes "attuned" to a particular element. This is done based on the first letter of the creature'sspecies:
o A-G creatures attune tofire
o H-M creatures attune towater
o N-S creatures attune toair
o T-Z creatures attune toearth

• Evolved creatures gain the ability to perform a special "elemental attack" in addition to their regular attack. This elemental attack is guaranteed never to miss, but it will never score a critical hit either. Additionally, there isno20% variance in the attack damage like there is with the regular attack. The damage done by an elemental attack depends on the element of the target creature:

o If the target creature is of the same element as the attacking creature, the elemental attack deals zero damage.
o If the target creature's element resists the attacking creature's element, the elemental attack deals 0.25x normal attackdamage.
o If the target creature's element is vulnerable to the attacking creature's element, the elemental attack deals 4x normal attackdamage.
o In all other cases, the elemental attack deals the attacking creature's normal attack damage.Thisincludessituations in which an evolved creature performs an elemental attack vs. a creature with no element (which could be an EvolvableCuteCreature who hasn't evolved yet, or just a regularCuteCreature).

The table below summarizes the effects of elemental attacks.

1. Write a subclass EvolvableCuteCreature that extends CuteCreature with the functionality described above. Here are a few guidelines for thissubclass:

• Remember that constructors are not inherited, so you'll need to provide one for theEvolvableCuteCreature
class. Use super to save yourself some coding if possible!

• Include an extra instance variable to indicate which element the creature is attunedto.

• Add a new elementalAttack(CuteCreature c) method. If an EvolvableCuteCreature tries to call this method without having evolved yet, display an appropriate errormessage.

• Override the levelUp() method from CuteCreature to handle the evolution process at level 20. (You should redeclare levelUp() as protected rather thanprivate.)

• Override the toString() method to include which element the creature is attunedto.

2. Write a client program that creates some EvolvableCuteCreature objects and tests your methods. You should especially focus on testing elementalAttack, since there are many different possible outcomes with that move!

Reference no: EM131604443

Questions Cloud

What annual interest rate is he paying on this loan : He will be paying $460 each month for the loan. What annual interest rate (APR) is he paying on this loan?
Compute net cash provided by operations : Using only the amounts given, compute net cash provided by operations, both without and with the reclassification of the receivables
American cancer society : American Cancer Society (ACS) is committed to helping people stay well and get well by finding cures and by fighting back.
Determine economic service life and respective aw : Determine the economic service life and the respective AW.
Write a subclass evolvablecutecreature : Write a client program that creates some EvolvableCuteCreature objects and tests your methods. You should especially focus on testing
What is the maximum profit if each item is sold : Suppose exactly 34 goods are produced. They all sell when the price is $7 each, but for each $1 increase in price, 2 fewer goods are sold.
What would you recommend to reach their goals : What would you recommend to reach their goals now and in retirement? How does risk return relationship of suggested changes compare to the existing portfolios?
Explain mental illness change during the middle ages : In what way did the treatment of abnormal behavior and mental illness change during the Middle Ages
Do the given quantities maximize profit for the company : The marginal revenue and marginal cost for a certain item are graphed in Figure. Do the following quantities maximize profit for the company?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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