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
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