Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here is the pokemon class you need to implement, and pokedex is an object that will collect all instances of your pokemon. After that you

image text in transcribedimage text in transcribedimage text in transcribedHere is the pokemon class you need to implement, and pokedex is an object that will collect all instances of your pokemon. After that you will need a client that creates a pokemon and then passes it to PokemonCard

image text in transcribed

This file is an interface. You must implement it in your code. public class Pokemon implements IPokemon{ In this file there are a number of methods that must be made in your code for it to compile. You may add more, but you MUST add these: import java.awt.image. Buffered Image; public interface IPokemon { //accessor methods public String getName; public int getHPO; public int getAtkO; public int getExpPts; public String getType(); public int getDefO; public Buffered Image getImage; public int getMaxHP; //mutator methods public int damage(int damage); public int heal(int heal); public int expUp (int exp); public String toString(); public interface IPokedex public void shuffle;//command to shuffle your pokemon in your pokedex public IPokemon) getPokedexO;//all pokemon in your pokedex public IPokemon[] getTeam ;//5 random pokemon from your pokedex Your pokedex is an object that will collect all instances of your pokemon. You will need the following line of code: public class Pokedex implements IPokedex{ Pokemon Card.java PokemonCard.java x import java.awt.*; import javax.swing.*; public class PokemonCard extends JFrame{ private IPokemon actor; private int size = 25; private int pad = 10; public PokemonCard(IPokemon actor){ this.actor = actor; setSize(400, 600); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setResizable(false); setTitle(actor.getName()); Font f = new Font("Arial", Font.BOLD, size); JPanel p = new JPanel(); p.setLayout(new BorderLayout(); p.setBackground(Color.WHITE); JLabel title = new JLabel(actor.getName()))} title. setFont(f); p.add(title, BorderLayout.NORTH); JPanel main = new MainPanel(); p.add(main, BorderLayout.CENTER); add(p); setVisible(true); private class MainPanel extends JPanel{ @Override public void paint Component(Graphics g) { g.drawImage(actor.getImage(), 0, 0, this.getWidth(), this.getHeight()/342, this); 9. setFont(new Font("Arial", Font, BOLD, size) g.drawstring("\tName: It" + actor.getName(), this.getWidth()/5, this.getHeight()/342 + pad) g.drawstring("\tType: It" + actor.getType(), this.getWidth()75, this.getHeight()/342+ size + pad) g.drawstring("\tHP: \t" + actor.getHP(), this.getWidth()/5, this.getHeight()/342 + 2 (size + pad)); Example: Buffered Image image = ImageI0.read(new File("pikachu.png")); IPokemon actor = new Pokemon("Pikachu", "Electric", 60, image); Pokemon Card card = new PokemonCard(actor); This file is an interface. You must implement it in your code. public class Pokemon implements IPokemon{ In this file there are a number of methods that must be made in your code for it to compile. You may add more, but you MUST add these: import java.awt.image. Buffered Image; public interface IPokemon { //accessor methods public String getName; public int getHPO; public int getAtkO; public int getExpPts; public String getType(); public int getDefO; public Buffered Image getImage; public int getMaxHP; //mutator methods public int damage(int damage); public int heal(int heal); public int expUp (int exp); public String toString(); public interface IPokedex public void shuffle;//command to shuffle your pokemon in your pokedex public IPokemon) getPokedexO;//all pokemon in your pokedex public IPokemon[] getTeam ;//5 random pokemon from your pokedex Your pokedex is an object that will collect all instances of your pokemon. You will need the following line of code: public class Pokedex implements IPokedex{ Pokemon Card.java PokemonCard.java x import java.awt.*; import javax.swing.*; public class PokemonCard extends JFrame{ private IPokemon actor; private int size = 25; private int pad = 10; public PokemonCard(IPokemon actor){ this.actor = actor; setSize(400, 600); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setResizable(false); setTitle(actor.getName()); Font f = new Font("Arial", Font.BOLD, size); JPanel p = new JPanel(); p.setLayout(new BorderLayout(); p.setBackground(Color.WHITE); JLabel title = new JLabel(actor.getName()))} title. setFont(f); p.add(title, BorderLayout.NORTH); JPanel main = new MainPanel(); p.add(main, BorderLayout.CENTER); add(p); setVisible(true); private class MainPanel extends JPanel{ @Override public void paint Component(Graphics g) { g.drawImage(actor.getImage(), 0, 0, this.getWidth(), this.getHeight()/342, this); 9. setFont(new Font("Arial", Font, BOLD, size) g.drawstring("\tName: It" + actor.getName(), this.getWidth()/5, this.getHeight()/342 + pad) g.drawstring("\tType: It" + actor.getType(), this.getWidth()75, this.getHeight()/342+ size + pad) g.drawstring("\tHP: \t" + actor.getHP(), this.getWidth()/5, this.getHeight()/342 + 2 (size + pad)); Example: Buffered Image image = ImageI0.read(new File("pikachu.png")); IPokemon actor = new Pokemon("Pikachu", "Electric", 60, image); Pokemon Card card = new PokemonCard(actor)

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

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions