Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need in java thanks Description There is a cricket that lives by our timeshare in Myrtle Beach, South Carolina. Most every night I hear it

need in java thanks

image text in transcribed

image text in transcribed

image text in transcribed

Description There is a cricket that lives by our timeshare in Myrtle Beach, South Carolina. Most every night I hear it patiently chirping away. Some nights it chirps faster than others, and it seems like the warmer it is, the faster it chirps. On several different nights, armed with a stopwatch and a thermometer, I recorded the frequency of the chirps and compared it to that night's air temperature. I later repeated the same experiment in a different area where the Clemson Cricket is prevalent. I realized the experiment holds true, except the Clemson Cricket always chirps 20% slower than the crickets at Myrtle Beach. Experimental Results The chirping follows a simple linear formula: Take the number of chirps, add 40 and divide that by 4 to get the temperature in degrees Fahrenheit Inversely you can predict how many chirps you'll hear here if you know the current temperature. The inverse formula is take the temperature, multiply it by 4 and subtract 40. Class Descriptions: Create an Environment class: It should store the current temperature as an int in a private attribute. o It should have getters/setters for the temperature. o It should have a constructor which sets the current temperature. Create a Cricket class: o Create a method getChirpCount() which takes in an Environment object as a parameter. o Using the above formula return the number of chirps you expect to hear given the temperate set in the Environment. o Return the number of chirps we'll hear. Create a ClemsonCricket class: Inherit from the cricket class o 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 getChirp Count() 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: o Prompt the user to enter a temperature until they enter - 1 o Create an environment object with that temperature o Create a regular Cricket and a ClemsonCricket object. o Call the getChirp Count() method in each, outputting the results as shown below. o 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) - 1

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

Database Concepts

Authors: David Kroenke, David J. Auer

3rd Edition

0131986252, 978-0131986251

More Books

Students also viewed these Databases questions