Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

code this This assignment is about objects, instance variables, methods and encapsulation. You will create two classes to simulate the world of ParrotCraft - a

code this image text in transcribed
image text in transcribed
This assignment is about objects, instance variables, methods and encapsulation. You will create two classes to simulate the world of "ParrotCraft" - a simple game world loosely based on MineCraft Parrot objects. In graphical applications, programmers often separate the model from the view. The model keeps track of the internal state of the program, and the view is in the middle between the user and the model. It talks to the user through a user interface, and it talks to the model by calling its methods and interpreting the return values from those methods. The model never talks directly to the user. This is not a graphical application. In this assignment, the Parrot class is the model and the ParrotCraft class implements a "view" that consists of a text-based conversation with the user. If you implement the model well, it should be easy to re-use it later in a graphical view. - A Parrot has a name, an integer number of hearts that represent its health, and the amount of cracker crumbs in its stomach, in grams. A Parrot can be tamed or untamed, it can be dead or alive, and it can be flying or sitting. - You can feed a Parrot some cracker crumbs. Its health goes up by 1 (maximum 3) every time you feed it. The amount of cracker crumbs in its stomach rises also. - When you feed a Parrot, there is a chance that the parrot will become tamed. The percentage chance of taming is 20 crumbs, where crumbs is the amount of cracker crumbs in kilograms you just fed it. - A Parrot can also eat too much and make itself sick. When a Parrot has more than 2.5kg of cracker crumbs in it's stomach its health (hearts) will go do down by 2 . If the health (hearts) becomes 0 , the Parrot becomes dead. - You can command a tamed Parrot to stay or fly. An untamed Parrot is always flying. - You can give a tamed Parrot a different tamed Parrot to play with. But the Parrots will rediscover the joy of their own species, making both of them untamed. - You can hit a Parrot and make its health go down by 1 (minimum 0). Hitting a Parrot always makes it untamed and sometimes makes it dead (if it has 0 health). 1 - Dead Parrots can't be fed, can't be told to stay or move, and can't play with other Parrots. 2 - When a Parrot is "born" (i.e., an instance created) it alive and untamed and flying with 3 health. By default, its name is "Julius" and it has 0.1kg of cracker crumbs in its stomach, but you can change its name and the amount of cracker crumbs in its stomach after you create the Parrot. (By using setters) - There should be a tostring method that returns a full report on a Parrot. 3 It is completely up to you what the return value of tostring looks like, but don't just use the default from Intellis. IMPORTANT BASIC RULE \#1: The Parrot class is the model. The model should never talk to the user. The model should request no input and produce no output. All input should be passed into the Parrot objects using the method parameters. All information to be outputted should be returned by the method

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

Handbook Of Relational Database Design

Authors: Candace C. Fleming, Barbara Von Halle

1st Edition

0201114348, 978-0201114348

More Books

Students also viewed these Databases questions

Question

List the time value of money variables.

Answered: 1 week ago