Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Smart Home Let's get your Java foundations solidified by examining a real house... the house of the future! In this exercise, imagine you've been

The Smart Home

Let's get your Java foundations solidified by examining a real house... the house of the future! In this exercise, imagine you've been tasked with creating a system that coordinates all the elements of a "Smart Home." These are homes that have built-in automation that handles the lighting, temperature, entertainment, and myriad appliances to make your life easier and more efficient. Not only are these things controlled remotely, but they often work together for a more seamless experience.

Start first by creating a new class called SmartHome.java. Inside your main function, you should do the following:

Accept user console input. It should take in the following commands:

"Change temperature"

"Play music"

"Stop music"

"Turn on television"

"Turn off television"

"Turn on light"

"Turn off light"

"Make a call"

"Answer doorbell"

"Close system"

write instance variables that represent the following (use appropriate data types):

Temperature

A/C setting

Is music playing? (yes/no)

Is the television on? (yes/no)

Music track selected

Television channel selected

Room light settings

Here are some requirements about how your system should operate:

When a user enters a command, the program should provide confirmation that the command has been executed

Set the appropriate variables to the corresponding user input

If the user is changing the light, ask him/her which room it should be for. Track the light in the following rooms (bedroom, kitchen, living room, bathroom, garage)

If the user is changing the temperature, ask him/her what temperature he/she would like. If the new temperature is higher than the previous, put the A/C setting at "heat." If the new temperature is lower than the previous, put the A/C at "cool." If the user is changing the music, ask him/her which song he/she would like. write a text file called "songs.txt" that has at least five different songs. Read the file list and check if the user's request is there. If it isn't, tell the user what songs are available. If it is, begin playing that song

If the user is turning on the TV, ask him/her which channel he/she would like. Create a text file called "channels.txt" that has at least five different channels. Read the file list and check if the user's request is there. If it isn't, tell the user what channels are available. If it is, turn the TV to that channel

If the user makes a call, turn off any electronics that are providing audio. Ask the user what number he/she wants to call. If the number is not a 10-digit number, tell him/her the format was incorrect and to try again

If the user answers the doorbell, turn off any other audio. Ask the user to input a message to send to the person waiting at the door

If the user requests the television be turned on, provide a follow-up question: "Would you like the lights dimmed?" If the living room lights are on, turn them off.

write a method that shuts the system down. This will be called when the user says, "Close system." It will reset all room settings and turn off any appliances. (Imagine this happening when the owner leaves for the day)

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

Sales Force Management Leadership Innovation Technology

Authors: Mark W. Johnston, Greg W. Marshall

12th Edition

1138951722, 978-1138951723

More Books

Students also viewed these Programming questions