SlideShare a Scribd company logo
1 of 3
Download to read offline
I need a Full Runnable code and UML Diagram for the following.
The Assignment
This assignment is about effectively using inheritance, association, overriding, and constructors.
Youre
going to work alone or with a partner to translate a description of the inhabitants of a game world
into a
set of classes that could serve as part of a model for a game or gaming utility, draw the UML class
diagram for these classes, and then implement them in Java.
Read the descriptions below carefully and try to take every detail into account in your design.
There
might be multiple ways to implement each attribute and ability. Just because your idea is different,
doesnt mean its wrong.
The Inhabitants of Foon
In town of Hogsface in the magical land of
Foon there are three kinds of Monsters: Orcs,
Goblins, and Manticores.
Attributes
All Monsters have a clan affiliation that
cannot change. They all have numeric ratings
for three basic attributes that describe their
abilities: Ferocity, Defense, and Magic. These
attributes can be raised or lowered by one
point at a time, within the range 0 to 20. The clan affiliation and basic attributes of a Monster are
obvious and can be easily retrieved by anyone.
All Monsters have 0 or more treasure. They all have a numeric health rating. If they have health >
0 they
are alive, otherwise they are dead.
The clan affiliation of a Monster cannot change, unless that monster is a Manticore theyre fickle
and
change clans all the time.
Every Goblin has exactly one other Goblin that is its sworn enemy. This enemy is fixed at birth and
never
changes, even if it dies.
An Orc can be Infantry or Warlord. Warlords have an integer leadership rating from 1 to 5. This
rating
can be raised or lowered by 1 point at a time. Every warlord has exactly 5 Infantry in his or her
command, and every Infantry member has exactly one Warlord that commands it. The
assignments of
Infantry to Warlord are frequently changed.
Abilities
Attack and Defense
When a Monster attacks, it produces a battle score equal to the average of its Ferocity,
Defense, and Magic scores. If its opponents attack score is higher, it loses health points
equal to the difference in attack scores. (e.g. if a Manticore with an attack score of 18.5 fights
a Goblin with an attack score of 10.7, the Goblin will lose 7.8 health.)
When a Manticore or a Warlord attacks, its battle score is greater than a normal Monsters
score by a factor of 1.5.
Dead Monsters cannot attack or defend themselves.
Healing
When a Warlord sounds its battle cry, it produces a health boost score equal to its leadership
rating multiplied by 5 and raises the health score of each of the Infantry in its command by
that amount.
Dead Warlords cannot sound their battle cry and dead Infantry cannot be healed.
Treasure
A monster can gain or lose treasure as the result of a fight. When a warlord gains treasure, it
gets a +1 leadership boost for every 10 points of treasure it receives.
A Dead monster cannot gain treasure.
The Design
Draw a UML class diagram for a set of classes to represent the Monsters of Foon. Make sure to
represent all instance variables, parameters, return values, and relationships between classes.
You can
create your UML diagram on paper, using UMLet or using draw.io. If you want to use a different
piece of
software, check with your instructor first.
Use inheritance to eliminate code duplication and overriding to avoid if statements (e.g. dont have
an if
statement to check if the monster is a Manticore before calculating its attack score).
Use encapsulation to restrict access to the instance variables as much as possible.
Include the minimum set of methods to implement the world as described above.
Include two constructors for each class: one that sets all instance variables, and one that sets just
the
clan affiliation and fills in default or random values for everything else.
Include a toString() method for every Monster type that prints its class name, its clan affiliation,
whether it is alive or dead, and its ratings (ferocity, magic, etc.). Make sure the output is easy to
read.
The Implementation
Implement the classes you designed in Java.
It would be a good idea to test each class by creating at least two instances (one for each
constructor),
calling each method, and printing the results of each method to standard output. But this is not
required. For this assignment, you are developing the model but not the view.
Use automatic code generation as much as you can (use Insert Code to create the starter code for
constructors, getters, setters and toString() methods).
Use the super and this keywords to eliminate code duplication wherever possible.
Check for errors in all methods (e.g. parameters out of range, null parameters, actions cant be
taken
when the Monster is dead, etc.). If an error happens, print a meaningful error message to standard
output and return immediately from the method. Make sure you test the error cases.
Optional Extras
This is purely a design exercise, but maybe it could be turned into some sort of a game. For
example, can
you simulate turn-based combat between an Orc and a Goblin? Can you make it graphical? Is
there
anything else you can do to make the town of Hogsface to life?
Handing In See the due date in Canvas. Hand in by attaching a zipped version of your .java (not
.class) files and your
class diagram to the Canvas Assignment.
Make sure you follow the Documentation Standards for the course.
Special Instructions for Pairs
If you work with a partner, follow these special instructions:
1. Both partners should work together on the design and the implementation. Use pair
programming when writing the code.
2. Both partners must hand in a copy of the design and the implementation for this assignment.
Late days for each partner will be tracked separately.
3. Each partner must also fill out the statement of effort and include that in the hand in.
Warning: If you do not include a statement of effort, it will be assumed that you worked alone,
which
means that your solution better not match anyone elses!
Evaluation
Your assignment will be evaluated for design (40%), implementation (40%), and documentation
(20%)
using the rubric in the drop box.

More Related Content

Similar to I need a Full Runnable code and UML Diagram for the followin.pdf

Java for android developers
Java for android developersJava for android developers
Java for android developersAly Abdelkareem
 
Pages From Keep On The Shadowfell2
Pages From Keep On The Shadowfell2Pages From Keep On The Shadowfell2
Pages From Keep On The Shadowfell2guestbc6b9b
 
Fun with Functional Programming in Clojure
Fun with Functional Programming in ClojureFun with Functional Programming in Clojure
Fun with Functional Programming in ClojureCodemotion
 
Functional programming in TypeScript
Functional programming in TypeScriptFunctional programming in TypeScript
Functional programming in TypeScriptbinDebug WorkSpace
 
Fun with Functional Programming in Clojure - John Stevenson - Codemotion Amst...
Fun with Functional Programming in Clojure - John Stevenson - Codemotion Amst...Fun with Functional Programming in Clojure - John Stevenson - Codemotion Amst...
Fun with Functional Programming in Clojure - John Stevenson - Codemotion Amst...Codemotion
 
Introduction to Erlang
Introduction to ErlangIntroduction to Erlang
Introduction to ErlangRaymond Tay
 

Similar to I need a Full Runnable code and UML Diagram for the followin.pdf (7)

Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Java for android developers
Java for android developersJava for android developers
Java for android developers
 
Pages From Keep On The Shadowfell2
Pages From Keep On The Shadowfell2Pages From Keep On The Shadowfell2
Pages From Keep On The Shadowfell2
 
Fun with Functional Programming in Clojure
Fun with Functional Programming in ClojureFun with Functional Programming in Clojure
Fun with Functional Programming in Clojure
 
Functional programming in TypeScript
Functional programming in TypeScriptFunctional programming in TypeScript
Functional programming in TypeScript
 
Fun with Functional Programming in Clojure - John Stevenson - Codemotion Amst...
Fun with Functional Programming in Clojure - John Stevenson - Codemotion Amst...Fun with Functional Programming in Clojure - John Stevenson - Codemotion Amst...
Fun with Functional Programming in Clojure - John Stevenson - Codemotion Amst...
 
Introduction to Erlang
Introduction to ErlangIntroduction to Erlang
Introduction to Erlang
 

More from sukhvir71

HW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdf
HW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdfHW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdf
HW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdfsukhvir71
 
httpswwwcancergovnewseventspressreleases2020lung.pdf
httpswwwcancergovnewseventspressreleases2020lung.pdfhttpswwwcancergovnewseventspressreleases2020lung.pdf
httpswwwcancergovnewseventspressreleases2020lung.pdfsukhvir71
 
Human impacts on the environment Prepare a detailed present.pdf
Human impacts on the environment Prepare a detailed present.pdfHuman impacts on the environment Prepare a detailed present.pdf
Human impacts on the environment Prepare a detailed present.pdfsukhvir71
 
HR praclitioners are increasingly performing gender pay audi.pdf
HR praclitioners are increasingly performing gender pay audi.pdfHR praclitioners are increasingly performing gender pay audi.pdf
HR praclitioners are increasingly performing gender pay audi.pdfsukhvir71
 
Humans have contributed to the majority of carbon dioxide C.pdf
Humans have contributed to the majority of carbon dioxide C.pdfHumans have contributed to the majority of carbon dioxide C.pdf
Humans have contributed to the majority of carbon dioxide C.pdfsukhvir71
 
i A content box using the lttextareagt tag which sho.pdf
i A content box using the lttextareagt tag which sho.pdfi A content box using the lttextareagt tag which sho.pdf
i A content box using the lttextareagt tag which sho.pdfsukhvir71
 
HuDs and Autnorties 014 points graded networkx has an imp.pdf
HuDs and Autnorties 014 points graded networkx has an imp.pdfHuDs and Autnorties 014 points graded networkx has an imp.pdf
HuDs and Autnorties 014 points graded networkx has an imp.pdfsukhvir71
 
humans What does the sample suggest about the use of 986F .pdf
humans What does the sample suggest about the use of 986F .pdfhumans What does the sample suggest about the use of 986F .pdf
humans What does the sample suggest about the use of 986F .pdfsukhvir71
 
Hunger Games Catching Fire uso de medios digitales y socia.pdf
Hunger Games Catching Fire uso de medios digitales y socia.pdfHunger Games Catching Fire uso de medios digitales y socia.pdf
Hunger Games Catching Fire uso de medios digitales y socia.pdfsukhvir71
 
I need full assignment with every steps Write a program tha.pdf
I need full assignment  with every steps Write a program tha.pdfI need full assignment  with every steps Write a program tha.pdf
I need full assignment with every steps Write a program tha.pdfsukhvir71
 
I need an explanation for both the wrong and correct answers.pdf
I need an explanation for both the wrong and correct answers.pdfI need an explanation for both the wrong and correct answers.pdf
I need an explanation for both the wrong and correct answers.pdfsukhvir71
 
I need an explanation for the wrong and the correct answer .pdf
I need an explanation for the wrong and the correct answer  .pdfI need an explanation for the wrong and the correct answer  .pdf
I need an explanation for the wrong and the correct answer .pdfsukhvir71
 
I need help building a dictionary for the unique packets tha.pdf
I need help building a dictionary for the unique packets tha.pdfI need help building a dictionary for the unique packets tha.pdf
I need help building a dictionary for the unique packets tha.pdfsukhvir71
 
I need a help with a project I need to identify Grass lawn.pdf
I need a help with a project I need to identify Grass lawn.pdfI need a help with a project I need to identify Grass lawn.pdf
I need a help with a project I need to identify Grass lawn.pdfsukhvir71
 
I need an excel formula that will return 1 for HE17HE21 and.pdf
I need an excel formula that will return 1 for HE17HE21 and.pdfI need an excel formula that will return 1 for HE17HE21 and.pdf
I need an excel formula that will return 1 for HE17HE21 and.pdfsukhvir71
 
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdf
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdfHxxxp19x21 H5TNii5x21 c Why akould you espect th.pdf
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdfsukhvir71
 
I measured the cooling rate X and surface hardness Y of .pdf
I measured the cooling rate X and surface hardness Y of .pdfI measured the cooling rate X and surface hardness Y of .pdf
I measured the cooling rate X and surface hardness Y of .pdfsukhvir71
 
How would you explain the statement that CPR should not be .pdf
How would you explain the statement that CPR should not be .pdfHow would you explain the statement that CPR should not be .pdf
How would you explain the statement that CPR should not be .pdfsukhvir71
 
i Local supranational and governmental organisations amp.pdf
i Local supranational and governmental organisations amp.pdfi Local supranational and governmental organisations amp.pdf
i Local supranational and governmental organisations amp.pdfsukhvir71
 
I need finding assessmentresolutionmon Chief Complaint.pdf
I need  finding assessmentresolutionmon  Chief Complaint.pdfI need  finding assessmentresolutionmon  Chief Complaint.pdf
I need finding assessmentresolutionmon Chief Complaint.pdfsukhvir71
 

More from sukhvir71 (20)

HW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdf
HW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdfHW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdf
HW8 Concept Deep Learning Q1 Neural Networrks 2 Points Se.pdf
 
httpswwwcancergovnewseventspressreleases2020lung.pdf
httpswwwcancergovnewseventspressreleases2020lung.pdfhttpswwwcancergovnewseventspressreleases2020lung.pdf
httpswwwcancergovnewseventspressreleases2020lung.pdf
 
Human impacts on the environment Prepare a detailed present.pdf
Human impacts on the environment Prepare a detailed present.pdfHuman impacts on the environment Prepare a detailed present.pdf
Human impacts on the environment Prepare a detailed present.pdf
 
HR praclitioners are increasingly performing gender pay audi.pdf
HR praclitioners are increasingly performing gender pay audi.pdfHR praclitioners are increasingly performing gender pay audi.pdf
HR praclitioners are increasingly performing gender pay audi.pdf
 
Humans have contributed to the majority of carbon dioxide C.pdf
Humans have contributed to the majority of carbon dioxide C.pdfHumans have contributed to the majority of carbon dioxide C.pdf
Humans have contributed to the majority of carbon dioxide C.pdf
 
i A content box using the lttextareagt tag which sho.pdf
i A content box using the lttextareagt tag which sho.pdfi A content box using the lttextareagt tag which sho.pdf
i A content box using the lttextareagt tag which sho.pdf
 
HuDs and Autnorties 014 points graded networkx has an imp.pdf
HuDs and Autnorties 014 points graded networkx has an imp.pdfHuDs and Autnorties 014 points graded networkx has an imp.pdf
HuDs and Autnorties 014 points graded networkx has an imp.pdf
 
humans What does the sample suggest about the use of 986F .pdf
humans What does the sample suggest about the use of 986F .pdfhumans What does the sample suggest about the use of 986F .pdf
humans What does the sample suggest about the use of 986F .pdf
 
Hunger Games Catching Fire uso de medios digitales y socia.pdf
Hunger Games Catching Fire uso de medios digitales y socia.pdfHunger Games Catching Fire uso de medios digitales y socia.pdf
Hunger Games Catching Fire uso de medios digitales y socia.pdf
 
I need full assignment with every steps Write a program tha.pdf
I need full assignment  with every steps Write a program tha.pdfI need full assignment  with every steps Write a program tha.pdf
I need full assignment with every steps Write a program tha.pdf
 
I need an explanation for both the wrong and correct answers.pdf
I need an explanation for both the wrong and correct answers.pdfI need an explanation for both the wrong and correct answers.pdf
I need an explanation for both the wrong and correct answers.pdf
 
I need an explanation for the wrong and the correct answer .pdf
I need an explanation for the wrong and the correct answer  .pdfI need an explanation for the wrong and the correct answer  .pdf
I need an explanation for the wrong and the correct answer .pdf
 
I need help building a dictionary for the unique packets tha.pdf
I need help building a dictionary for the unique packets tha.pdfI need help building a dictionary for the unique packets tha.pdf
I need help building a dictionary for the unique packets tha.pdf
 
I need a help with a project I need to identify Grass lawn.pdf
I need a help with a project I need to identify Grass lawn.pdfI need a help with a project I need to identify Grass lawn.pdf
I need a help with a project I need to identify Grass lawn.pdf
 
I need an excel formula that will return 1 for HE17HE21 and.pdf
I need an excel formula that will return 1 for HE17HE21 and.pdfI need an excel formula that will return 1 for HE17HE21 and.pdf
I need an excel formula that will return 1 for HE17HE21 and.pdf
 
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdf
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdfHxxxp19x21 H5TNii5x21 c Why akould you espect th.pdf
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdf
 
I measured the cooling rate X and surface hardness Y of .pdf
I measured the cooling rate X and surface hardness Y of .pdfI measured the cooling rate X and surface hardness Y of .pdf
I measured the cooling rate X and surface hardness Y of .pdf
 
How would you explain the statement that CPR should not be .pdf
How would you explain the statement that CPR should not be .pdfHow would you explain the statement that CPR should not be .pdf
How would you explain the statement that CPR should not be .pdf
 
i Local supranational and governmental organisations amp.pdf
i Local supranational and governmental organisations amp.pdfi Local supranational and governmental organisations amp.pdf
i Local supranational and governmental organisations amp.pdf
 
I need finding assessmentresolutionmon Chief Complaint.pdf
I need  finding assessmentresolutionmon  Chief Complaint.pdfI need  finding assessmentresolutionmon  Chief Complaint.pdf
I need finding assessmentresolutionmon Chief Complaint.pdf
 

Recently uploaded

Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 

Recently uploaded (20)

Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 

I need a Full Runnable code and UML Diagram for the followin.pdf

  • 1. I need a Full Runnable code and UML Diagram for the following. The Assignment This assignment is about effectively using inheritance, association, overriding, and constructors. Youre going to work alone or with a partner to translate a description of the inhabitants of a game world into a set of classes that could serve as part of a model for a game or gaming utility, draw the UML class diagram for these classes, and then implement them in Java. Read the descriptions below carefully and try to take every detail into account in your design. There might be multiple ways to implement each attribute and ability. Just because your idea is different, doesnt mean its wrong. The Inhabitants of Foon In town of Hogsface in the magical land of Foon there are three kinds of Monsters: Orcs, Goblins, and Manticores. Attributes All Monsters have a clan affiliation that cannot change. They all have numeric ratings for three basic attributes that describe their abilities: Ferocity, Defense, and Magic. These attributes can be raised or lowered by one point at a time, within the range 0 to 20. The clan affiliation and basic attributes of a Monster are obvious and can be easily retrieved by anyone. All Monsters have 0 or more treasure. They all have a numeric health rating. If they have health > 0 they are alive, otherwise they are dead. The clan affiliation of a Monster cannot change, unless that monster is a Manticore theyre fickle and change clans all the time. Every Goblin has exactly one other Goblin that is its sworn enemy. This enemy is fixed at birth and never changes, even if it dies. An Orc can be Infantry or Warlord. Warlords have an integer leadership rating from 1 to 5. This rating can be raised or lowered by 1 point at a time. Every warlord has exactly 5 Infantry in his or her command, and every Infantry member has exactly one Warlord that commands it. The assignments of Infantry to Warlord are frequently changed. Abilities Attack and Defense When a Monster attacks, it produces a battle score equal to the average of its Ferocity,
  • 2. Defense, and Magic scores. If its opponents attack score is higher, it loses health points equal to the difference in attack scores. (e.g. if a Manticore with an attack score of 18.5 fights a Goblin with an attack score of 10.7, the Goblin will lose 7.8 health.) When a Manticore or a Warlord attacks, its battle score is greater than a normal Monsters score by a factor of 1.5. Dead Monsters cannot attack or defend themselves. Healing When a Warlord sounds its battle cry, it produces a health boost score equal to its leadership rating multiplied by 5 and raises the health score of each of the Infantry in its command by that amount. Dead Warlords cannot sound their battle cry and dead Infantry cannot be healed. Treasure A monster can gain or lose treasure as the result of a fight. When a warlord gains treasure, it gets a +1 leadership boost for every 10 points of treasure it receives. A Dead monster cannot gain treasure. The Design Draw a UML class diagram for a set of classes to represent the Monsters of Foon. Make sure to represent all instance variables, parameters, return values, and relationships between classes. You can create your UML diagram on paper, using UMLet or using draw.io. If you want to use a different piece of software, check with your instructor first. Use inheritance to eliminate code duplication and overriding to avoid if statements (e.g. dont have an if statement to check if the monster is a Manticore before calculating its attack score). Use encapsulation to restrict access to the instance variables as much as possible. Include the minimum set of methods to implement the world as described above. Include two constructors for each class: one that sets all instance variables, and one that sets just the clan affiliation and fills in default or random values for everything else. Include a toString() method for every Monster type that prints its class name, its clan affiliation, whether it is alive or dead, and its ratings (ferocity, magic, etc.). Make sure the output is easy to read. The Implementation Implement the classes you designed in Java. It would be a good idea to test each class by creating at least two instances (one for each constructor), calling each method, and printing the results of each method to standard output. But this is not required. For this assignment, you are developing the model but not the view. Use automatic code generation as much as you can (use Insert Code to create the starter code for constructors, getters, setters and toString() methods). Use the super and this keywords to eliminate code duplication wherever possible.
  • 3. Check for errors in all methods (e.g. parameters out of range, null parameters, actions cant be taken when the Monster is dead, etc.). If an error happens, print a meaningful error message to standard output and return immediately from the method. Make sure you test the error cases. Optional Extras This is purely a design exercise, but maybe it could be turned into some sort of a game. For example, can you simulate turn-based combat between an Orc and a Goblin? Can you make it graphical? Is there anything else you can do to make the town of Hogsface to life? Handing In See the due date in Canvas. Hand in by attaching a zipped version of your .java (not .class) files and your class diagram to the Canvas Assignment. Make sure you follow the Documentation Standards for the course. Special Instructions for Pairs If you work with a partner, follow these special instructions: 1. Both partners should work together on the design and the implementation. Use pair programming when writing the code. 2. Both partners must hand in a copy of the design and the implementation for this assignment. Late days for each partner will be tracked separately. 3. Each partner must also fill out the statement of effort and include that in the hand in. Warning: If you do not include a statement of effort, it will be assumed that you worked alone, which means that your solution better not match anyone elses! Evaluation Your assignment will be evaluated for design (40%), implementation (40%), and documentation (20%) using the rubric in the drop box.