Answered step by step
Verified Expert Solution
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 types: Negative, Positive and Dual character. If the score of the character is below then it is negative, if it is above then it is a positive character and if the score is then it is a dual character.
This problem statement can be solved using the following steps:
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
Create classes: GameCharacter and Number, which will initialise the game character and get and set the request number respectively
Create the Negative character class which will check the score of the character and display the appropriate message according to the input character
Create the Dual character class which will check the score of the character and display the appropriate message according to the input character
Create the Positive character class which will check the score of the character and display the appropriate message according to the input character
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
This is a negative character as its score is
This is a dual character as its score is
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started