Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have trouble solving this java problem. for example, my problem is how I connect each method to return happy or sad after playing with

I have trouble solving this java problem. for example, my problem is how I connect each method to return happy or sad after playing with other chicken or the parameter for laying eggs . have a problem with the returns of each method.

his assignment is about objects, instance variables, methods and encapsulation. You will create two classes to simulate the world of ChickenCraft a simple game world loosely based on MineCraft Chicken objects. A Chicken can be happy or unhappy, and it can be alive or dead. A Chicken has a name, a certain number of hearts that represent its health, and a certain amount of seed in its stomach, in kilograms. You can feed a chicken some seed. Is hearts go up by 1 (maximum 4) every time you feed it. But dont feed it too much! A chicken with more than 2 kg of seed in its stomach will die. You can give a Chicken a different Chicken to play with. This makes both Chickens happy You can hit a Chicken and make its hearts go down by 1 (minimum 0). Hitting a Chicken always makes it unhappy and sometimes makes it dead (if it has 0 hearts). method Calls return values output devices input devices You can get eggs from a Chicken you get one egg for every 0.25 kg of seed in its stomach (and the seeds used are gone from its stomach afterwards). If the Chicken is happy, you get twice as many eggs. But laying eggs makes a Chicken unhappy. Dead Chicken cant be fed, cant lay eggs, and cant play with other Chickens. When a Chicken is born (i.e. created) it alive and happy and has 4 hearts. By default, its name is Nancy and it has 0.1kg of seed, but you can change its name and the amount of seed it has after you create the chicken.

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

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions