Tamagotchi πΈπΆ
https://www.youtube.com/watch?v=tJE-5nIOXKI
We will today be creating a tamagotchi. A tamagotchi is a virtual pet that you can interact with. It was quite a big deal back when i was young. Not so much anymore.
A tamagotchi had to be kept alive. You could feed it, play with it, dress it etc.

Tamagotchi details
We have to create 4 different classes
Game- Class that initiates a game and takes user inputTamagotchi- Super class forCatandDogCat- A class that inherits fromTamagotchiDog- A class that also inherits fromTamagotchi
Game class
Game classThis class can be seen as the "main" class. It takes data from a user and now creates either a Cat object or a Dog object.
Tamagotchi class
Tamagotchi classIs the super class for Cat and Dog. It contains the more general characteristics of Cat and Dog
It could have some of the following attributes
nameagemoodenergy.
And it could have some of the following methods. But its up to you!
play()feed()sleep(6)...
Cat and Dog
Cat and DogThe Cat and Dog should extend Tamagotchi!
You come up with what attributes and methods relevant for a Cat and a Dog
Fx a Dog could maybe bark(). It's up to you
One requirement is that both Cat and Dog should at some point override a method from Tamagotchi!
Requirements
GameclassTamagotchiclassCatandDogclasses that extendsTamagotchiIn the
CatandDogclasses there should be at least one override methodDraw a class diagram of all your classes and create a sequence diagram of one specific use case
Your task
A user should be able to create either a Cat or a Dog with a name. That pet will then be created with random values.
Your task is now to create a Tamagotchi that is fun to play with using the above requirements! Create a new game object using the Game class that can spawn a cat, a dog or both
Example
This is just an example please come up with your own virtual pet πΈ
Optional tasks
Make the pet objects interact with each other
Create more pets than just
CatandDogMake it possible for time to pass in the game! Fx if a pet has not gotten food in some time it becomes hungry. You could fx do that by in the
Gameclass creating atickmethod that simulates that time has elapsed. Thistickmethod can then be called each second that then affects the pets statsYour idea here!
Handin
Hand in on fronter here: https://kea-fronter.itslearning.com/LearningToolElement/ViewLearningToolElement.aspx?LearningToolElementId=927870
Hand in via git!
Handin checklist
Have you tested that the code works?
Have you written comments to the code?
Have you thought of a good structure?
Is the code easy to understand and read?
Does the variablename make sense?
Last updated
Was this helpful?