Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions

Question

Hi, This code is not working for me model

Answered: 1 week ago

Question

CL I P COL Astro- L(1-cas0) Lsing *A=2 L sin(0/2)

Answered: 1 week ago