Creat a program that is part of a control system for a house. Create two Boolean...

60.1K

Verified Solution

Question

Programming

Creat a program that is part of a control system for a house.Create two Boolean variables: doorUnLocked and lightOn. Set both tofalse. Create an int variable: currentTemp. Set the currentTempvalue to 70 Create two more Boolean variables: heatOn andcoolingOn. Set both of these values to false. Ask the user if theywant to unlock the door, turn on the light and what value thetemperature should be. If they want to unlock the door, setdoorUnlocked to true. If they do not want to unlock the door, setthe doorUnlocked value to false. If they want to turn on the lightset lightOn to true. If they do not want to turn on the light setthe lightOn to false. For the desired temperature value, if thedesired value is the same as the currentTemp, do nothing. If thedesired value is less than the currentTemp set coolingOn to trueand heatOn to false. If the desired value is more than thecurrentTemp set heatOn to true and coolingOn to false. Display thestate of the door (locked or unlocked), the state of the lights (onor off) and the desired temperature and the current temperature.Ask the user if they want to make changes. If they do, loop backand ask for all three values again. If no changes are desired, endthe program.

Answer & Explanation Solved by verified expert
4.0 Ratings (693 Votes)
HiProgramimport javautilScannerHCS classpublic class HCS main method public static void mainString args variables declaration boolean doorUnLocked false boolean lightOn false int currentTemp 70 boolean heatOn false boolean coolingOn false    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students