//File: Pokemon.java //Name: Trai Pham //Date: 03/02/2020 //Course: CSE 8B /** class that represents a single Pokemon **/ import java.util.Random; public class Pokemon{ private static final int MAX_DAMAGE = 10; private static final int MAX_LEVEL = 100; private String dexNumber; private String name; private int level; private Random random; /** @param String of PokemonDex number, name of pokemon, and int of pokemon's level @return nothing Constructor **/ public Pokemon(String dexNumber, String name, int level) throws MinLevelException, MaxLevelException{ //checks the different exceptions this.dexNumber = dexNumber; this.name = name; if(level < 1){ throw new MinLevelException(name); } else if(level > MAX_LEVEL){ throw new MaxLevelException(name); } else{ this.level = level; } this.random = new Random(); } /** @param nothing @return String getter for Pokemon's name **/ public String getName(){ return this.name; } /** @param nothing @return int getter for Pokemon's level **/ public int getLevel(){ return this.level; } /** @param nothing @return Random Object getter for Pokemon's name **/ public Random getRandom(){ return this.random; } /** @param nothing @return Strings prints the message **/ @Override public String toString(){ return this.dexNumber; } /** @param nothing @return int gives you the attack **/ public int attack(){ //random object randomizes the attack to a max damage of 10 int damage = this.random.nextInt(MAX_DAMAGE); return damage; } }