Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You have been creating code around our Ultimate game of The Revengers. We will continue the same example for most of the following patterns as

You have been creating code around our Ultimate game of The Revengers. We will continue the same example for most of the following patterns as well. All the characters in the game will have a score associated with them. You have to build a code where depending on the score, output should mention the type of the character.
There will be 3 types: Negative, Positive and Dual character. If the score of the character is below 0 then it is negative, if it is above 0 then it is a positive character and if the score is 0 then it is a dual character.
This problem statement can be solved using the following steps:
1. Create a class Chain which will define the character, the character chain and the process function which will take the score of the character as input
2. Create 2 classes: GameCharacter and Number, which will initialise the game character and get and set the request number respectively
3. Create the Negative character class which will check the score of the character and display the appropriate message according to the input character
4. Create the Dual character class which will check the score of the character and display the appropriate message according to the input character
5. Create the Positive character class which will check the score of the character and display the appropriate message according to the input character
6. Write the client code which will take the character score as input and call the process function
The sample output will look like this when the process function is called:
This is a positive character as its score is 90
This is a negative character as its score is -50
This is a dual character as its score is 0

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_2

Step: 3

blur-text-image_3

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