Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*****I posted in screenshots because it didn't allow me to post the whole question****** AP COMPUTER SCIENCE AP COMPUTER SCENCE e the requirement to enforce

image text in transcribedimage text in transcribedimage text in transcribed

*****I posted in screenshots because it didn't allow me to post the whole question******

AP COMPUTER SCIENCE AP COMPUTER SCENCE e the requirement to enforce invariants and post-conditions listed abova. Pokemon Accessors You must provide public accessors for all seven fields listed above. POKEMONTM REVOLUTION 1 INHERITANCE AND POLYMORPHISM Pokemon Mutators You must provide Public mutators for the damage and energy fields-making sure to maintain th invariants described above. For this assignment you will practice be developing your mastery of object inheritance and palymerphism. Mare specifically you will be implementing number of clssses related to the Nintendo Geme Boy and Nintendo DS Eek enga-fanns which arc derived from the eelsegg0" card gama Pokemon Overrides Override the toStoing methed. it must print return the following string containing information about oll the fields in the class including iterating over and displaying the attackby calling the method on oach of the attacks. The format must lack like the following sample (escepe charecters must not be visible 2 BASE CLASSES Charmander, speed 50, Defense 50, HP 50, Danage , Energy oin t Flare: Energ 2, Danage +20 n e leep: Energy 1, Spee-10in 2.1 POKEMON CLASS All of the Dgsegg0you develop in this assignment must be derived from single base cless, the PRRRp class which will be the grandparents of your actual Peben The class must have the specified fields, acceors, mutators, and overrides as described below. Other Pokemon Methods You must supply the two methods described below. Both must return false Fields Your Pake dess must have seven pr vate fields as follows Type Sering 2.2 ATTACK CLASS The name of your gobemoo Must not be null or empty The spaad / rat of attack. Must b greater than 2ero. The detance at your e Must be greater than zero. The number of hit points for your pabeveo Must be grester than zero The attacks for this pekeo Must have at least one attack. Speed Fields Your Artack class must have private three fields as follow: fense Type String Attac Actack The name of the attack. Must not be null or empty The damage this Pohas sustained. Must be greater than or qual to zero Energy The energy required for the attack. 1 and less than or equal to S Must be greater than ar equal to Energy The enargy associated with this potemen Must be greater than equal to zero. Defaults to zero. When the energy value is changed, i must not change by more than 1 Value of the attack. Cen be positive or negative (must not be zero). Absalute vallue must be less than or equal to 10 times the energy value and must be multiple of 10. You must enforce the invariant described above in all constructors and mutstors. In addition, the constructors (only) must enforce the following post-conditions that a) the sum of the speed, defense and be must not exceed 150, b) there must be between 1 and 3 attacks,c the aum of the absolute value o the attack values must nat exceed 150 Throughaut the code below you must enforce the invarianes described for each field above. If performing a given operation would violate the specified irveriants, then you must throw en UrsalARAIRESEARRR Attack Constructors You must have two constructors. The tirst constructor must accept parameters forall threc tields in the order listed above. The sacond constructor must have paramaters for the first two fialds listed above, nama and value, and calls the ccher constructor passing 1 for energy If performing a iven operation would viclate the specified invariants, then you must throw an You must have two constructors. The first constructor must accept parameters for the first five fields in the order listed abave. The second constructor must accept a name and the array of attacks. it must then cal the other constructor passing 50 as the value for the other three parameters. Attack Accessors You must provide public accessors for all three fields listed sbove AP COMPUTER SCENCE AP COMPUTER SOCI Attack Overrides Override the tingmethod. It must return the following string Constructors You must have two constructors that match the constructors of the supercless and cell the constructors of the super class with all the same parameters Note that the

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

Oracle Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

More Books

Students also viewed these Databases questions

Question

How do you add two harmonic motions having different frequencies?

Answered: 1 week ago