Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java programming language UI Grid class Panel to hold the world (the grid with critters) Panel to hold controls (initial values, steps, critter count, empty

Java programming language image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
UI Grid class Panel to hold the "world" (the grid with critters) Panel to hold controls (initial values, steps, critter count, empty cell count, buttons, etc) Panel to display the header Style the form (borders, background image, etc) Set the proper size of all panels Method to display the world (show the critters and empty cells) Draw the grid with the critters onto the form Loop through the array of organisms and represent them as a label Organism class Parent class that represent organism. Fly and Spider classes will inherit from Organism cla Encapsulate common attribute and behaviors (refer to the diagram) Getter, setters, contractors, and other necessary methods. Fly class Inherits from Organism class Attributes, getter, setters, and contractors No need to overwrite breed0, move0, starve0 methods as it is done in part II No need to define method that determines the cell to move to as it is done in part II Spider class Inherits from Organism class No need to overwrite breed0, move0, starve0 methods as it is done in part II No need to define method determines the cell to move to as it is done in part II Attributes, getter, setters, and contractors World class It represents a collection of Organisms in space Organism grid attribute (multi-dimensional array Constructor that initializes the world- creates the array of empty cells (null items) Method that randomly puts specified number organisms to the grid *Getter to get an Organism at specified index Setter to place an Organism to a specified index Cell class Visual representation of an Organism on the form Inherits from JLabel Attributes, getters, setters Constructor that initializes Cell by assigning the indexes and organism and displaying the WordCell *This is an object designed to hold x and y coordinates to simplify handling the pair valu Flle Predator-Prey simulation Step Steps Completed 0 Empty space count: 40 Fly count 5 Spider count: 4 Initial Values Fly Count Spider Count 4- World Size Initialze Fly ell extends Label +void incrementTicks +void breed +void move +boolean starve x int Organism (abstract class) y int size: int breedTicks: int starveTicks: int move Ticks: int -moveRangelnCells: int counterMove Ticks: int WorldCell celiToMove oid setBackgroundlmage(String imagePath) '-Tr -counterBreedTicks: int counterStarveTicks: int orld world: World WorldCell vold incrementTicks int worldSize + abstract void breed -X: int Organismoll erid Organism getAtfint x, int y): Orgamism void setAtlint x, int y, Organism org void setAt(Organism org) void void boolean isinWorld(int x, int y) +abstract void move) y: int +abstract boolean starve) + abstract WorldCell cellToMove type, int count) Spider hasEaten: boolean void incrementTicks) + void breed + void move + boolean starve +WorldCell celiToMove: Ul_Grid world: World cellSize: int worldSize: int flyCount: int spiderCount: int void initGrid(int wSize, int countFly, int countSpider) void displayWordinGrid(World world void setPanelSize0 UI Grid class Panel to hold the "world" (the grid with critters) Panel to hold controls (initial values, steps, critter count, empty cell count, buttons, etc) Panel to display the header Style the form (borders, background image, etc) Set the proper size of all panels Method to display the world (show the critters and empty cells) Draw the grid with the critters onto the form Loop through the array of organisms and represent them as a label Organism class Parent class that represent organism. Fly and Spider classes will inherit from Organism cla Encapsulate common attribute and behaviors (refer to the diagram) Getter, setters, contractors, and other necessary methods. Fly class Inherits from Organism class Attributes, getter, setters, and contractors No need to overwrite breed0, move0, starve0 methods as it is done in part II No need to define method that determines the cell to move to as it is done in part II Spider class Inherits from Organism class No need to overwrite breed0, move0, starve0 methods as it is done in part II No need to define method determines the cell to move to as it is done in part II Attributes, getter, setters, and contractors World class It represents a collection of Organisms in space Organism grid attribute (multi-dimensional array Constructor that initializes the world- creates the array of empty cells (null items) Method that randomly puts specified number organisms to the grid *Getter to get an Organism at specified index Setter to place an Organism to a specified index Cell class Visual representation of an Organism on the form Inherits from JLabel Attributes, getters, setters Constructor that initializes Cell by assigning the indexes and organism and displaying the WordCell *This is an object designed to hold x and y coordinates to simplify handling the pair valu Flle Predator-Prey simulation Step Steps Completed 0 Empty space count: 40 Fly count 5 Spider count: 4 Initial Values Fly Count Spider Count 4- World Size Initialze Fly ell extends Label +void incrementTicks +void breed +void move +boolean starve x int Organism (abstract class) y int size: int breedTicks: int starveTicks: int move Ticks: int -moveRangelnCells: int counterMove Ticks: int WorldCell celiToMove oid setBackgroundlmage(String imagePath) '-Tr -counterBreedTicks: int counterStarveTicks: int orld world: World WorldCell vold incrementTicks int worldSize + abstract void breed -X: int Organismoll erid Organism getAtfint x, int y): Orgamism void setAtlint x, int y, Organism org void setAt(Organism org) void void boolean isinWorld(int x, int y) +abstract void move) y: int +abstract boolean starve) + abstract WorldCell cellToMove type, int count) Spider hasEaten: boolean void incrementTicks) + void breed + void move + boolean starve +WorldCell celiToMove: Ul_Grid world: World cellSize: int worldSize: int flyCount: int spiderCount: int void initGrid(int wSize, int countFly, int countSpider) void displayWordinGrid(World world void setPanelSize0

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_2

Step: 3

blur-text-image_3

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

Database Design Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

More Books

Students also viewed these Databases questions

Question

2. Identify conflict triggers in yourself and others

Answered: 1 week ago