This is my java assignment. I really need help with it.
It is basicallY a Cyber Pet program where in you make the use of a GUI. Here is the file that you can download the whole question from.
You gotta have 2 packages : One for the GUI and the other for the CyberPet. The GUI package contains the GUI code . In the GUI package, there are 2 GUI.
GUI1 is a normal interface where it asks the user to choose the pet he/she wants. The feature of naming the pet also includes in this.
You can refer to this link .. I want the GUI to be somethin like this ..
Check out the combo box demo .. It should display the picture while selecting the choice of the pet.
GUI1 also has a button named "Enter".
When you click on ENTER , it takes you to another frame that has displays the picture of the pet in the centre.
The GUI2 should possess a “Hungry” button which when pressed causes the pet to move towards its prey in steps of fixed length, while the prey continues to move in a random fashion. It also prints a console message “The pet is hungry”.
When the prey is within a pre-determined distance from the pet, the pet ‘eats’ the prey as follows:
(i) the frog shoots out a long red tongue that touches the fly and then the tongue retracts. The fly disappears and is assumed to be eaten.
(ii) The cat moves on top of the mouse so that the mouse is no longer visible and the mouse is assumed to have been eaten.
A console message is printed “The pet is no longer hungry”
It will display something saying "Pet is not hungry anymore" in the console when it has finished eating the prey.
This is using the just one pet.
Additional feature: If possible, make another GUI named GUI3 wherein all the pets go behind their respective preys and eat them up.