Question: please answer in java Create a ClemsonCricket class: Inherit from the cricket class Override the getChripCount() method. It should take an Environment object as a

please answer in java
please answer in java Create a ClemsonCricket class: Inherit from the cricket
class Override the getChripCount() method. It should take an Environment object as

Create a ClemsonCricket class: Inherit from the cricket class Override the getChripCount() method. It should take an Environment object as a parameter Calculate the number of chirps for a Clemson Cricket which chirps 20% slower than the other Crickets. Hint, you should be able to call the getChirpCount() in your parent and simply calculate 80% of that. Return the number of chirps we'll hear. In your driver class let's run a simulation: Prompt the user to enter a temperature until they enter - 1 Create an environment object with that temperature o Create a regular Cricket and a ClemsonCricket object. Call the getChirpCount() method in each, outputting the results as shown below. Don't output a chirp count when they enter -1.just exit. Using your IDE create a UML diagram for your objects. Save it as a PDF. Sample Output: What is the current temperature? (Enter -1 to exit) 50 Normal cricket: 50 degrees yields 160 chirps per minute Clemson cricket: 50 degrees yields 128 chirps per minute What is the current temperature? (Enter -1 to exit) 60 Normal cricket: 60 degrees yields 200 chirps per minute Clemson cricket: 60 degrees yields 160 chirps per minute What is the current temperature? (Enter -1 to exit) 80 Normal cricket: 80 degrees yields 280 chirps per minute Clemson cricket: 80 degrees yields 224 chirps per minute What is the current temperature? (Enter -1 to exit) 100 Normal cricket: 100 degrees yields 360 chirps per minute Clemson cricket: 100 degrees yields 288 chirps per minute What is the current temperature? (Enter -1 to exit) class Environment { private int temperature; public Environment(int temperature) { this. temperature = temperature; } public int get Temperature() { return temperature; } public void setTemperature(int temperature) { this. temperature = temperature; } } class Cricket public int getChirpCount(Environment environment) { return 4 * environment.getTemperature() - 40; } } class ClemsonCricket extends Cricket { @Override public int getChirpCount(Environment environment) { return (int) (0.8 * super.getChirpCount(environment)); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To implement the solution in Java follow these steps Define the Environment Class This class holds the temperature information Define the Cricket Clas... View full answer

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!