Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please describe step by step how to do and I have to complete this only with intellij in java class The Assignment: The World of
please describe step by step how to do and I have to complete this only with intellij in java class
The Assignment: The World of "ParrotCraft" 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. Your first step should be to create a UML class diagram to represent a Parrot. You should create this diagram using UML software like UML et or draw.io (links on Ganvas). Don't use a plain word processor like Microsoft Word. If you want to use a different piece of software, you must check with the instructor first. UML. Diagrams that are generated automatically from code are also not allowed. - A Parrot has a name, an integer number of hearts that represent its health, and the amount of cracker crumbs in its stomach, in kilograms. 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 2: Implement the Parrot and ParrotCraft Classes Once the class diagram is finished, implement your Parrot class in Java code. Then write a main method in a different class to simulate a user interacting with the Parrots in the world of ParrotCraft. This method should create three Parrot objects and allow a user to interact with each one using a menu interface. It's up to you how you structure the dialog, but one possibility is shown in the example dialog below. 1. Tamed DEAD Parrot Julius: 2.1kg crumbs, 0 hearts 2. Untamed Parrot Nancy: 0.6kg crumbs, 1 heart, flying 3. Tamed Parrot Johnette: 1.0kg crumbs, 3 hearts, sitting 1.Feed2.Command3.Play4.Hit5.Quit Which parrot? 3 Ouch! 1. Tamed DEAD Parrot Julius: 2.1kg crumbs, 0 hearts 2. Untamed Parrot Nancy: 0.6kg crumbs, 1 heart, flying 3. Untamed Parrot Johnette: 1.0kg crumbs, 2 hearts, flying 1. Feed 2. Command 3. Flay 4. Hit 5. Quit Choice: 1 How much? 1.3 You tamed Nancy! 1. Tamed DEAD Parzot Jul1us: 2.1kg crumbs, 0 hearts 2. Tamed Parrot Nancy: 1.9kg crumbs, 2 hearts, flying 3. Untamed Pazrot Johnette: 1.0kg crumbs, 2 hearts, flying Choice: 4 Which parrot? 3 Ouch! 1. Tamed DEAD Parrot Julius: 2.1kg crumbs, 0 hearts 2. Untamed Parrot Nancy: 0.6kg crumbs, 1 heart, flying 3. Untamed Parrot Johnette: 1.0kg crumbs, 2 hearts, flying 1. Feed 2. Command 3. Play 4. Hit 5. Quit Choice: 1 How much? 1.3 You tamed Nancy! 1. Tamed DEAD Parrot Julius: 2.1kg crumbs, 0 hearts 2. Tamed Parrot Nancy: 1.9kg crumbs, 2 hearts, flying 3. Untamed Parrot Johnette: 1.0kg crumbs, 2 hearts, flying 1. Feed 2. Command 3. Play 4. Hit 5. Quit Choice: 2 Which parrot? 1 Fly or stay? stay It's stone dead!" 1. Tamed DEAD Parrot Julius: 2.1kg crumbs, 0 hearts 2. Tamed Parrot Nancy: 1.9kg crumbs, 2 hearts, flying 3. Untamed Parrot Johnette: 1.0kg crumbs, 2 hearts, flying IMPORTANT BASIC RULE \#2: The main method is the view. It talks to the user, calls the appropriate Parrot methods in response to the user's input, and displays the results. It does not determine the results of a user's actions or keep track of anything. That's the job of the Parrot objects. Error Handling If the user makes a mistake (feeds a negative amount of seeds, asks a Parrot to play with a dead Parrot, etc.) this should be reported to the user. But remember, the ParrotCraft class does not implement any logic to decide what happened, and the Parrot class is not allowed to use System.out. Extra challenge: Implement your code in the animate method of the EXAnimationTemplate instead of in a ma in method. You will still get input from the user in the console, but you can show the Parrots on the canvas. See GraphicsExampleForAssignment2. java for an example of this way of using animate. Encapsulation and Documentation Make sure you encapsulate your instance variables. Only allow access through methods, using get and set method naming if appropriate. Don't forget the toString method, make sure you follow the Documentation Standards posted on Canvas. Handing In See the due date and time on the Canvas assignment. Hand in by attaching a zipped file of your two .java (not .class) files and your class diagram to the drop box. Evaluation Your assignment will be evaluated for performance (20\%), class diagram (20\%), structure (40\%), and documentation (20%) using the rubric in the drop box. ' He has ceased to be! 2He 's shuffled off this mortal coil, run down the curtain and joined the choir invisible. This is an ex-parrot! 3 I took the liberty of examining that parrot when I got it home, and I discovered the only reason that it had been sitting on its perch in the first place was that it had been NAILED there. "I know a dead parrot when I see one, and I'm looking at one right nowStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started