Question: PLEASE IN JAVA 1.4.2 The deer in Canada spend most of the day playing. In particular, they play if the temperature is between 60 degrees

PLEASE IN JAVA 1.4.2

The deer in Canada spend most of the day playing. In particular, they play if the temperature is between 60 degrees Fahrenheit and 90 degrees Fahrenheit (inclusive). However, in summer, the upper limit is 100 degrees Fahrenheit instead of 90 degrees Fahrenheit. Given an int temperature and a boolean isSummer, print true if the deer play and false otherwise. Ask the user to input whether it is summer, and input the temperature. Use a while loop to get the correct input. The prompt to user for input should ask for a number for temperature and a true or false for isSummer. Repeat the loop if either input is not the correct type and give the user the option to quit.

//deerPlay(70, false)  true //deerPlay(95, false)  false //deerPlay(95, true)  true public boolean deerPlay(int temp, boolean isSummer) { if(isSummer && (temp >= 60 && temp <= 100)) return true; if(!isSummer && (temp >= 60 && temp <= 90) ) return true; return false; }; 

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!