programming

Directions: 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”.

Parameters:  Complete the attached Programming Assignment 1  Download Complete the attached Programming Assignment 1

For all assignments and exercises (with the exception of MyProgrammingLab), submissions should be done as a packaged zip file that contains the following: all .java and .class files from your project and a screenshot of the code operating on your computer. You can save this image as a .jpg or .png. Name the zip file submission in the format: NAME_COURSE_ASSIGNMENT_DATE.zip Most systems will allow ZIP files to be created by just selecting all your files and right clicking. If not, you can use WinZip (Links to an external site.)  or WinRar (Links to an external site.).

Programming Assignment 1 – 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”

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

• Create 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)

To get you started, here’s a simple framework that will continuously read input until the user shuts

down the system. You are welcome to expand from here:

 

 

 

Include appropriate comments throughout your code. Remember to use standard Java naming

conventions. For reference, check out:

https://www.javaguides.net/2018/08/java-standard-naming-conventions.html

 

Put your name and information about the program at the beginning of your program. Submit your

SmartHome.java, SmartHome.class, and a screenshot of it in operation on your computer. Package all

of these in a zip file and name the submission in the format:

NAME_COURSE_ASSIGNMENT_DATE.zip

 

 

 

 

“image: Freepik.com”. This document has been designed using resources from Freepik.com

 

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published.