game. You will create a character and then use it to battle a computer generated opponent. There are three possible classes, with the following attributes: Sword Fighter Unicorn Sorcerer Dance Battler HP: 120 Attack: 40 Defense: 0.20 ClassID: 1 HP: 80 Attack: 35 Defense: 0.60 ClassID: 2 HP: 100 Attack: 20 Defense: 0.42 ClassID: 3 You will create a NPC class that has these three attribute. It should also have an attribute for Name. You will then create the following methods in the NPC class:  A constructor that takes in a Name string and a ClassID int. It should use the value of the ClassID to assign values to the other attributes (using the chart above)  Getter methods for all five attributes, and a Setter method for HP that subtracts the object’s HP by the value passed in.  calculateAttack ◦ This method returns

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

In Java

Assignment 7 B: Battle! For our last assignment in CSE 1321L, we’re going to recreate a basic battle system from a video game. You will create a character and then use it to battle a computer generated opponent. There are three possible classes, with the following attributes: Sword Fighter Unicorn Sorcerer Dance Battler HP: 120 Attack: 40 Defense: 0.20 ClassID: 1 HP: 80 Attack: 35 Defense: 0.60 ClassID: 2 HP: 100 Attack: 20 Defense: 0.42 ClassID: 3 You will create a NPC class that has these three attribute. It should also have an attribute for Name. You will then create the following methods in the NPC class:  A constructor that takes in a Name string and a ClassID int. It should use the value of the ClassID to assign values to the other attributes (using the chart above)  Getter methods for all five attributes, and a Setter method for HP that subtracts the object’s HP by the value passed in.  calculateAttack ◦ This method returns a float value. It takes in a float that represents the opponent’s defense percentage. It should multiply the object’s attack by the inverse of the opponent’s defense percentage, and return that value. For example: 100 * (1 – 0.60) = 40  calculateDefense ◦ This method returns nothing. It takes in a float that represents the opponent’s attack power. It should multiply the opponent’s attack by the inverse of the object’s defense percentage, then subtract 6 additional points from the result. This value should then be subtracted from the object’s HP.  isStillAlive ◦ This method returns a boolean value. It should check if the object’s HP is less than or equal to 0. If it is, then return FALSE. Otherwise, return TRUE.  You may add other “helper” methods to reduce redundant code, although this is not required. You should then create a driver class, Assignment7B. This program should do the following:  Prompt the user for a custom name and what class they want their character to be. You should use this information to create an NPC object.  Randomly generate another NPC object to represent the opponent. You can do this by randomly generating the two primitive values, then using them to construct the opponent NPC.  Create a loop that runs until one of the opponents runs out of HP. You will first prompt the player to either attack or defend. Then, you will have the opponent randomly choose to either attack or defend. ◦ If both the human and computer player choose to defend, do nothing. ◦ If both of them attack, then call the calculateAttack function on both objects. ◦ If one attacks and one defends, call the calculateDefense function on the defending object.  After both choices are made, display messages indicating the actions take and the remaining HP for both sides.  When one or both players are defeated, stop the loop and print the results. Sample Output: [Generic RPG Battle System] Enter your name: Morgan Enter your battle class: Unicorn Sorcerer Morgan the Unicorn Sorcerer, your opponent is Brad the Battle Dancer! -Round 1- Do you (a)ttack or (d)efend? a Morgan the Unicorn Sorcerer attacked Brad the Battle Dancer! Brad now has 79.7 HP. Brad the Battle Dancer attacked Morgan the Unicorn Sorcerer! Morgan now has 72 HP. -Round 2- Do you (a)ttack or (d)efend? d Morgan the Unicorn Sorcerer is on guard. Brad the Battle Dancer is on guard. -Round 3- Do you (a)ttack or (d)efend? d Morgan the Unicorn Sorcerer is on guard. Brad the Battle Dancer attacked Morgan the Unicorn Sorcerer! Morgan now has 70 HP. //Skipping ahead to the end of this epic battle (THIS IS NOT PART OF //THE OUTPUT Brad the Battle Dancer was defeated... Morgan the Unicorn Sorcerer wins!

 

In Java

(A) Object-Orie X CSE 1321L: X b Answered: X D2L Module 08 X
←
Digital Fabrication L...
|||
Assignment 8 - FA 2021
87°F
Mostly sunny
Sign In
ccse.kennesaw.edu/fye/M8%20-%20Assignment%207%20SP22%20v1.1.pdf
Think Java: How to... ✪ Programming Fund... FYE Resources - Col...
X
C In Java Plea X
Slides & Videos - C...
6 / 6
ano by tancomy gonordung mon
construct the opponent NPC.
50%
Sample Output:
[Generic RPG Battle System]
Create a loop that runs until one of the opponents runs out of HP. You will first
prompt the player to either attack or defend. Then, you will have the opponent
randomly choose to either attack or defend.
If both the human and computer player choose to defend, do nothing.
If both of them attack, then call the calculateAttack function on both objects.
If one attacks and one defends, call the calculateDefense function on the
defending object.
After both choices are made, display messages indicating the actions take and
the remaining HP for both sides.
When one or both players are defeated, stop the loop and print the results.
-Round 2-
Do you (a)ttack or (d)efend? d
C IN JAVA As: X
Enter your name: Morgan
Enter your battle class: Unicorn Sorcerer
Morgan the Unicorn Sorcerer, your opponent is Brad the Battle Dancer!
Morgan the Unicorn Sorcerer is on guard.
Brad the Battle Dancer is on guard.
1321 Labs and Assi...
+
-Round 1-
Do you (a)ttack or (d)efend? a
Morgan the Unicorn Sorcerer attacked Brad the Battle Dancer!
Brad now has 79.7 HP.
Brad the Battle Dancer attacked Morgan the Unicorn Sorcerer!
Morgan now has 72 HP.
Brad the Battle Dancer was defeated...
Morgan the Unicorn Sorcerer wins!
-Round 3-
Do you (a)ttack or (d)efend? d
Morgan the Unicorn Sorcerer is on guard.
Brad the Battle Dancer attacked Morgan the Unicorn Sorcerer!
Morgan now has 70 HP.
//Skipping ahead to the end of this epic battle (THIS IS NOT PART OF
//THE OUTPUT
H
Submission:
1. You will submit two, three, or four separate files (depending on whether you put your
classes in one file or two separate ones)
2. File names and class names must be correct.
3. Upload all files (simultaneously) to the assignment submission folder in Gradescope.
Assignmen X
IJ
G what is an
X
C The given
X
OneDrive
0
+
ㅁ
Screenshot saved
The screenshot was added to your
OneDrive.
C Update:
X
3:06 PM
7/14/2022
Transcribed Image Text:(A) Object-Orie X CSE 1321L: X b Answered: X D2L Module 08 X ← Digital Fabrication L... ||| Assignment 8 - FA 2021 87°F Mostly sunny Sign In ccse.kennesaw.edu/fye/M8%20-%20Assignment%207%20SP22%20v1.1.pdf Think Java: How to... ✪ Programming Fund... FYE Resources - Col... X C In Java Plea X Slides & Videos - C... 6 / 6 ano by tancomy gonordung mon construct the opponent NPC. 50% Sample Output: [Generic RPG Battle System] Create a loop that runs until one of the opponents runs out of HP. You will first prompt the player to either attack or defend. Then, you will have the opponent randomly choose to either attack or defend. If both the human and computer player choose to defend, do nothing. If both of them attack, then call the calculateAttack function on both objects. If one attacks and one defends, call the calculateDefense function on the defending object. After both choices are made, display messages indicating the actions take and the remaining HP for both sides. When one or both players are defeated, stop the loop and print the results. -Round 2- Do you (a)ttack or (d)efend? d C IN JAVA As: X Enter your name: Morgan Enter your battle class: Unicorn Sorcerer Morgan the Unicorn Sorcerer, your opponent is Brad the Battle Dancer! Morgan the Unicorn Sorcerer is on guard. Brad the Battle Dancer is on guard. 1321 Labs and Assi... + -Round 1- Do you (a)ttack or (d)efend? a Morgan the Unicorn Sorcerer attacked Brad the Battle Dancer! Brad now has 79.7 HP. Brad the Battle Dancer attacked Morgan the Unicorn Sorcerer! Morgan now has 72 HP. Brad the Battle Dancer was defeated... Morgan the Unicorn Sorcerer wins! -Round 3- Do you (a)ttack or (d)efend? d Morgan the Unicorn Sorcerer is on guard. Brad the Battle Dancer attacked Morgan the Unicorn Sorcerer! Morgan now has 70 HP. //Skipping ahead to the end of this epic battle (THIS IS NOT PART OF //THE OUTPUT H Submission: 1. You will submit two, three, or four separate files (depending on whether you put your classes in one file or two separate ones) 2. File names and class names must be correct. 3. Upload all files (simultaneously) to the assignment submission folder in Gradescope. Assignmen X IJ G what is an X C The given X OneDrive 0 + ㅁ Screenshot saved The screenshot was added to your OneDrive. C Update: X 3:06 PM 7/14/2022
(A) Object-Orie X CSE 1321L: X b Answered: X D2L Module 08 X
←
Digital Fabrication L...
|||
✰ccse.kennesaw.edu/fye/M8%20-%20Assignment%207%20SP22%20v1.1.pdf
Think Java: How to... ✪ Programming Fund... FYE Resources - Col...
Assignment 8 - FA 2021
Sign In
87°F
Mostly sunny
X
Choice: 4
HP: 120
Attack: 40
Defense: 0.20
ClassID: 1
C In Java Plea X
5 / 6
.
Slides & Videos - C...
●
Goodbye!
Assignment 7B: Battle! For our last assignment in CSE 1321L, we're going to recreate
a basic battle system from a video game. You will create a character and then use it to
battle a computer generated opponent. There are three possible classes, with the
following attributes:
Sword Fighter
●
50%
HP: 80
Attack: 35
Defense: 0.60
ClassID: 2
Unicorn Sorcerer
C IN JAVA As: X
You will create a NPC class that has these three attribute. It should also have an
attribute for Name.
You will then create the following methods in the NPC class:
A constructor that takes in a Name string and a ClassID int. It should use the
value of the ClassID to assign values to the other attributes (using the chart
above)
1321 Labs and Assi...
+
Dance Battler
HP: 100
Attack: 20
Defense: 0.42
ClassID: 3
Getter methods for all five attributes, and a Setter method for HP that subtracts
the object's HP by the value passed in.
calculate Attack
This method returns a float value. It takes in a float that represents the
opponent's defense percentage. It should multiply the object's attack by the
inverse of the opponent's defense percentage, and return that value. For
example:
100 (1-0.60) = 40
calculate Defense
This method returns nothing. It takes in a float that represents the opponent's
attack power. It should multiply the opponent's attack by the inverse of the
object's defense percentage, then subtract 6 additional points from the result.
This value should then be subtracted from the object's HP.
is StillAlive
This method returns boolean value. It should check if the object's HP is less
than or equal to 0. If it is, then return FALSE. Otherwise, return TRUE.
You may add other "helper" methods to reduce redundant code, although this is
not required.
You should then create a driver class, Assignment7B. This program should do the
following:
• Prompt the user for a custom name and what class they want their character to
be. You should use this information to create an NPC object.
Sample Output:
[Generic RPG Battle System]
Randomly generate another NPC object to represent the opponent. You can do
this by randomly generating the two primitive values, then using them to
construct the opponent NPC.
Create a loop that runs until one of the opponents runs out of HP. You will first
prompt the player to either attack or defend. Then, you will have the opponent
randomly choose to either attack or defend.
Enter your name: Morgan
Enter your battle class: Unicorn Sorcerer
If both the human and computer player choose to defend, do nothing.
If both of them attack, then call the calculateAttack function on both objects.
If one attacks and one defends, call the calculateDefense function on the
defending object.
H
After both choices are made, display messages indicating the actions take and
the remaining HP for both sides.
When one or both players are defeated, stop the loop and print the results.
Assignmen X
G what is an
X
C The given
X
0
+
ㅁ
X
C Update:
3:06 PM
7/14/2022
Transcribed Image Text:(A) Object-Orie X CSE 1321L: X b Answered: X D2L Module 08 X ← Digital Fabrication L... ||| ✰ccse.kennesaw.edu/fye/M8%20-%20Assignment%207%20SP22%20v1.1.pdf Think Java: How to... ✪ Programming Fund... FYE Resources - Col... Assignment 8 - FA 2021 Sign In 87°F Mostly sunny X Choice: 4 HP: 120 Attack: 40 Defense: 0.20 ClassID: 1 C In Java Plea X 5 / 6 . Slides & Videos - C... ● Goodbye! Assignment 7B: Battle! For our last assignment in CSE 1321L, we're going to recreate a basic battle system from a video game. You will create a character and then use it to battle a computer generated opponent. There are three possible classes, with the following attributes: Sword Fighter ● 50% HP: 80 Attack: 35 Defense: 0.60 ClassID: 2 Unicorn Sorcerer C IN JAVA As: X You will create a NPC class that has these three attribute. It should also have an attribute for Name. You will then create the following methods in the NPC class: A constructor that takes in a Name string and a ClassID int. It should use the value of the ClassID to assign values to the other attributes (using the chart above) 1321 Labs and Assi... + Dance Battler HP: 100 Attack: 20 Defense: 0.42 ClassID: 3 Getter methods for all five attributes, and a Setter method for HP that subtracts the object's HP by the value passed in. calculate Attack This method returns a float value. It takes in a float that represents the opponent's defense percentage. It should multiply the object's attack by the inverse of the opponent's defense percentage, and return that value. For example: 100 (1-0.60) = 40 calculate Defense This method returns nothing. It takes in a float that represents the opponent's attack power. It should multiply the opponent's attack by the inverse of the object's defense percentage, then subtract 6 additional points from the result. This value should then be subtracted from the object's HP. is StillAlive This method returns boolean value. It should check if the object's HP is less than or equal to 0. If it is, then return FALSE. Otherwise, return TRUE. You may add other "helper" methods to reduce redundant code, although this is not required. You should then create a driver class, Assignment7B. This program should do the following: • Prompt the user for a custom name and what class they want their character to be. You should use this information to create an NPC object. Sample Output: [Generic RPG Battle System] Randomly generate another NPC object to represent the opponent. You can do this by randomly generating the two primitive values, then using them to construct the opponent NPC. Create a loop that runs until one of the opponents runs out of HP. You will first prompt the player to either attack or defend. Then, you will have the opponent randomly choose to either attack or defend. Enter your name: Morgan Enter your battle class: Unicorn Sorcerer If both the human and computer player choose to defend, do nothing. If both of them attack, then call the calculateAttack function on both objects. If one attacks and one defends, call the calculateDefense function on the defending object. H After both choices are made, display messages indicating the actions take and the remaining HP for both sides. When one or both players are defeated, stop the loop and print the results. Assignmen X G what is an X C The given X 0 + ㅁ X C Update: 3:06 PM 7/14/2022
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 9 steps with 8 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education