Question: 1. Either use the Java project from the first coding exercise, or create a new one, as you prefer. Create a new Java class named

 1. Either use the Java project from the first coding exercise,

1. Either use the Java project from the first coding exercise, or create a new one, as you prefer. Create a new Java class named goodDogCarlExpanded Put a heading on it similar to what you did for the first and second coding assignments. 2. Carl the Dog, like most humans, cares about how much food, play time, and walking time he gets, not just if he has these things. He is also an older dog now (13) and as he has aged he has grown some peculiarities. Please read through the following conditions that cause Carl to be happy or not happy. In general Carl is happy if he has been fed between 1 and 3 cups of food AND he has either been on a walk for between 30 and 60 minutes OR has been played with for between 15 and 30 minutes. However, being an old dog, if he has had a combined play and walk time of 75 minutes or more, he will not be happy, not matter what. He also doesn't like being short changed if his walk and play times combine to be 50 minutes or less, then he has to have 2 cups of food or more to be happy (but not more than 3, which makes him feel ill). 3. Create integer variables for the walk and play quantities, and a double variable for the food variable. Declare them as: int walkAmount; int playAmount; double foodAmount; 4. Create a static method that returns a Boolean variable that is true is Carl is happy and false if Carl is not happy. You should have a method declaration of: public static boolean isCarlHappy(int walkAmount, int playAmount, double foodAmount) In this method, implement the rules to determine if Carl is happy or not. 5. Test your method with several values of the variables that illustrate the correctness of your code (i.e, test different scenarios). Display the results of your tests by displaying: "If Carl has been walked for _ minutes, played with for _ minutes, and fed_cups of food, then he is 6. Make sure you add at least two comments in your code to explain what you are doing. 11

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!