Simulating a Turkey Farm

computer science

Description

Simulating a Turkey Farm We have two classes that are going to be created, TurkeyFarm.java and Turkey.java. A skeleton has been provided for Turkey. Provide implementations for the following methods: 1. birth(). This method will set the current Turkey's pregnancy status to false if not already false. 2. isAdult(). This method returns true if age is over the adult age 3. isPregnant(). This method returns true if pregnant. 4. istimeToDie(). This method returns true if age is over the max age. 5. getID(). This method returns the ID of the Turkey. 6. getPairID(). This method returns the ID of the turkey it is paired with. 7. unPair(). 



This method removes the current value for who it is paired with and sets it to 0. 8. passTime(). This method will add to each of the day values. This includes the age and pregnancy. 9. slaughter(). This method will increment a counter that keeps track of how many Turkeys have been slaughtered so far. 10. isPaired(). This method returns true if the turkey's pairID is not equal to zero. 11. mate(Turkey t1, Turkey t2). 



This method will determine which of the two is female. Then it will make the female pregnant and set the days pregnant to 0. 12. pair(Turkey t1, Turkey t2). This method will set the pairID of each turkey to the ID of the other. 13. getGender(). This method returns the number for the gender, either 1 or 2. 14. isPregnancyDue(). This method returns true if the daysPregnant is greater than Pregnancy duration. 15. The constructor for the Turkey has not been implemented. It should include initialize all the variables for a single turkey as well as change any necessary static variables. Be sure to use the random number generator to randomly assign genders. Methods not written but need to be implemented. 16. toString(). This method will return a string with all of the relevant information about a turkey. 17. Static methods to 1) Get & Print total number of Turkeys. 2) Get & Print total number of adult Turkeys. 3) Get & Print total number of not adult Turkeys. 4) Get & Print total number of paired Turkeys 5) Get & Print total number of not paired Turkeys 18. The necessary variables and changes needed to make the above static methods work as required. 19. Additional methods should be implemented as needed if they make the above methods easier to code.


Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.