Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

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!

Java, Programming

  • Category:- Java
  • Reference No.:- M92413156
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Java

Question slideshows or carousels are very popular in

Question : Slideshows (or carousels) are very popular in websites. They allow web developers to display news or images on the website in limited space. In this code challenge, you are required to complete the JavaScript ...

In relation to javaa what is constructor the purpose of

(In relation to Java) A. What is constructor? the purpose of default constructor? B. How do you get a copy of the object but not the reference of the object? C. What are static variables and instance variables? D. Compar ...

Assessment instructionsin this assessment you will complete

Assessment Instructions In this assessment, you will complete the programming of two Java class methods in a console application that registers students for courses in a term of study. The application is written using th ...

Retail price calculatorwrite a java program that asks the

Retail Price Calculator Write a JAVA program that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: (If an item's wholesale cost is 5. ...

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Can someone please help me with the following java

can someone please help me with the following java question The input is an N by N matrix of nonnegative integers. Each individual row is a decreasing sequence from left to right. Each individual column is a decreasing s ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As