Certain Professor Oak from Pallet Town
Added on - 16 Sep 2019
BackgroundWord has spread about the great work you’ve been doing creating software to predict monstercaptures. A certain Professor Oak from Pallet Town is particularly impressed with your work,and is interested in enlisting your aid in an exciting new endeavour. He heard that programswritten in Java can run on millions of different devices, so he wants you to develop a portable,text-based Pokedex program that his field agents can use in their varying computer systems thatare used in many different regions.ObjectiveTo be the very best, like no one ever was.Your AssignmentArmed with your newly gained knowledge of Arrays and Objects, your task is to develop aprogram which makes use of simple but well-structured Pokemon and Pokedex classes in orderfor field agents to keep track of the strange new Pokemon they encounter on their journies.Your Pokedex will have the advanced functionality that Professor Oak’s field agents have cometo expect: They will be able to:add new species of Pokemon to their Pokedexlist of all the Pokemon that have been storedlist an individual Pokemon’s statisticssort their PokedexThe program that you create and submitmustcontain three files, named exactly asfollows:Pokemon.java,Pokedex.java, andProject4.java, which will holdyourmain()method. Each of the .java files and their associated classes are describedbelow:The Pokemon ClassYour Pokemon class, which is stored in Pokemon.java, defines what constitutes an objectof type Pokemon. The classmusthave the following members:Fields for the following attributes:speciesattackdefensespeedModifier methods (used in testing, not in menu):publicvoidgrow(int boost)This method increasesattackbased on the givenboostpublicvoidharden(int boost)This method increasesdefensebased on givenboost
publicvoidhaste(int boost)This method increasesspeedbased on the givenboost“Getter”/“Setter” methods for each attribute:publicStringgetSpecies()publicvoidsetSpecies(String spc)Names should consist ofone-wordstrings ONLY.publicintgetAttack()publicvoidsetAttack(int atk)publicintgetDefense()publicvoidsetDefense(int def)publicintgetSpeed()publicvoidsetSpeed(int spd)An appropriate constructor:publicPokemon(String species)The constructor must initialize all 4 fields of the Pokemon objectwith the constructor’s parameters:species = species Passed inattack = (Length of species name * 4) + 2defense = (Length of species name * 2) + 7speed = (Length of species name * 3) +5The Pokedex ClassThe Pokedex class, which is stored in Pokedex.java, will define what constitutes anobject of type Pokedex. The Pokedex classmusthave the following members:An array of Pokemon objects, which will hold any pokemon that the useradds to it.You may have any additional fields that may aid the rest of theclass’s functionality (strongly recommended). It is recommendedto keep a variable in the Pokedex that allows you to keep track ofthe number of Pokemon you have stored so far.The user will have to input the size of the arrayMember methods (More details on the usage each method are providedlater in the project description- Youmusthave the same methoddefinitions as the ones provided below):publicStringlistPokemon()
This method returns an array of Strings containing thenames of every Pokemon stored in the Pokedex. ThePokedex class has a field that is an array of Pokemonobjects. This method will look at each Pokemon stored inthe Pokedex object’s Pokemon array, access the name ofthe species, and save it into an Array of Strings.TheStringoutput should be a list containing thenames of all Pokemon species currently saved in thePokedex, with no empty indexes. For example, if yourPokedex holds 20 Pokemon and you have only stored 10,yourStringreturned should have a length of 10, not20.If the Pokedex is currently empty, return null.Seeexample runs for details.publicbooleanaddPokemon(String species)This method takes a String parameter called species andstores it in the Pokedex. It does this by adding it to thenextfree indexin the Pokedex’s Pokemon array.Returntrueif the operation was successful, otherwisereturnfalse.You should check the Pokedex’s Pokemon arrayto see if it already contains the species of Pokemonwhich you are trying to add (regardless of casedifferences). If it does, doNOTadd the Pokemonto the Pokedex - instead, print the word“Duplicate”and returnfalseYou should also design this method so that it doesnot add the Pokemon if the Pokedex is already atthe maximum size. If the Pokedex object’sPokemon array is already full, it should insteadprint the word “Max”and returnfalseSee the sample run for more details.publicintcheckStats(String species)This method returns an array of 3 integers containing theattack, defense, and speed of the pokemon specified by aspeciesstring argument,in that order.If the given Pokemon is not in the dex,returnnull.When checking whether the givenPokemon exists, usecase-insensitive string comparisons.See sample run formore details.