Pokedex.java this class will represent the Poked that will hold the Pokémon. This class will contain the following private instance variable: Compare Pokémon[] poked: this will hold an originally...

Pokedex.java this class will represent the Poked that will hold the Pokémon. This class will contain the following private instance variable: Compare Pokémon[] poked: this will hold an originally unsorted array of Pokémon that you will be tasked with sorting This class will contain the following public instance methods void sortByType(): This will sort the Pokémon in the poked based on primary Type and secondary Type in ascending order. Void sort Byname (): This will sort the Pokémon in the poked based on name in ascending order. Void sortied (): This will sort the Pokémon in the poked based on id in ascending order. This sorting algorithm should be based off of any of the sorts you've learned in class Hint Hint*: Be sure to use Compare Pokémon’s compare by methods this class has the following constructor: Poked (String fileName) this constructor must instantiate the array with a length of 10. O Scan through the file and instantiate Pokémon objects using the respective attributes written in the text files and store it in the array. If a user inputs an invalid file, be sure to handle it by catching the FileNotFoundException and printing out "This file does not exist!” Note: You may encounter a checked Exception called InvalidPokemonException while crafting this constructor. If the exception occurs, your constructor should not catch it, but rather allow it to be thrown. The details of this exception are described below. Pokemon.txt contains certain Pokémon with missing attributes while Pokemon2.txt contains all valid Pokémon so that you can test if your constructor correctly instantiates objects. Poked (File file) this constructor should do the same thing as the previous constructor, but it will have 1 file passed in as a parameter rather than the name of the file. Constructor chaining will prove very useful here.
Nov 21, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here