Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objectives: Inheritance is an essential aspect of object - oriented programming languages like java. It allows one class to inherit the features of a parent

Objectives: Inheritance is an essential aspect of object-oriented programming languages like java. It allows one class to inherit the features of a parent class. This allows for reusability, overriding, and abstraction. Abstraction is the process of only showing the essential detail to the user. This can be achieved by using abstract classes. An abstract class is declared with the keyword abstract. An abstract class cannot be created as an instance in the code. By completing the assignment, students will demonstrate knowledge of the following:
Creating abstract classes
Creating inheriting classes
Task Description: A game company has come to you to ask for you to create characters in their game. There are 3 kinds of characters: attacking, defending, and healing.
Every character will have a name, base health value, shield value, and power level (0100).
Each subtype of character has another attribute specific to them. Healers have a healing value, dealers have an attack value, and defenders have defense values.
Each subtype of character can use an ability and what the ability does is different for each subtype. Healers will heal a target Character for their healing value up to the target's base health value, dealers will deal damage to a Character's HP for their attack value, and defenders will raise a Character's shield by their defense value.Figure 1 Sample output for printCharacter(PrintStream)
Your code should have a single abstract class called Character. You should have 3 classes that extend from the Character class. The Character class should have 2 abstract methods: useAbility (Character) and printCharacter(PrintStream).
Your main method only needs to demonstrate that your classes work as expected. Create at least one of each subtype of Character and a "dummy" Character you can use
for testing by applying each ability to it. Print the results to the console so that they can be verified by eye. Also, show that each printCharacter method outputs as expected.Objectives: Inheritance is an essential aspect of object-oriented programming languages like java. It allows one class to inherit the features of a parent class. This allows for reusability, overriding, and abstraction. Abstraction is the process of only showing the essential detail to the user. This can be achieved by using abstract classes. An abstract class is declared with the keyword abstract. An abstract class cannot be created as an instance in the code. By completing the assignment, students will demonstrate knowledge of the following:
Creating abstract classes
Creating inheriting classes
Task Description: A game company has come to you to ask for you to create characters in their game. There are 3 kinds of characters: attacking, defending, and healing.
Every character will have a name, base health value, shield value, and power level (0100).
Each subtype of character has another attribute specific to them. Healers have a healing value, dealers have an attack value, and defenders have defense values.
Each subtype of character can use an ability and what the ability does is different for each subtype. Healers will heal a target Character for their healing value up to the target's base health value, dealers will deal damage to a Character's HP for their attack value, and defenders will raise a Character's shield by their defense value.Figure 1 Sample output for printCharacter(PrintStream)
Your code should have a single abstract class called Character. You should have 3 classes that extend from the Character class. The Character class should have 2 abstract methods: useAbility (Character) and printCharacter(PrintStream).
Your main method only needs to demonstrate that your classes work as expected. Create at least one of each subtype of Character and a "dummy" Character you can use
for testing by applying each ability to it. Print the results to the console so that they can be verified by eye. Also, show that each printCharacter method outputs as expected.
image text in transcribed

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2018 Dublin Ireland September 10 14 2018 Proceedings Part 1 Lnai 11051

Authors: Michele Berlingerio ,Francesco Bonchi ,Thomas Gartner ,Neil Hurley ,Georgiana Ifrim

1st Edition

3030109240, 978-3030109240

More Books

Students also viewed these Databases questions