Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I NEED HELP ASAP PLEASE. THE SCREENSHOT BELOW IS HAS THE INSTRUCTIONS AND THE ORIGNAL CODE. ITS JAVA AND PLEASE IF POSSIBLE PROVIDE INSTRUCTIONS IF

I NEED HELP ASAP PLEASE. THE SCREENSHOT BELOW IS HAS THE INSTRUCTIONS AND THE ORIGNAL CODE. ITS JAVA AND PLEASE IF POSSIBLE PROVIDE INSTRUCTIONS IF YOU HELP.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Programming Assignment 2 - Smart Home continued You may have noticed that the Smart Home application we built in the last assignment was a little clumsy to implement. If we keep adding new devices, variables will be harder to track, and settings will be harder to manage. You may also notice that certain parts of the Smart Home could be grouped into different categories (for example, both the Music and Television devices shared audio settings). We could make our program more efficient and capable of growth by using inheritance. Object-oriented design to the rescue! Here are your program requirements for your revised Smart Home: Create a parent class called "Device. This should have methods and variables to access and change the power status and the room they are located in Create Child Classes called Entertainment, Appliance," "Security," and "Light." These should all inherit from "Device" Create Child Classes that inherit from Entertainment" that include "Music" and "Television Create Child Classes that inherit from Appliance" that include "HVAC," "Oven," and "Refrigerator" Create Child Classes that inherit from Security" that include "MotionSensor" and "Camera Each class should have constructors and member variables. Keep variables private; only allow methods to access them Populate each class with relevant functionality (you can use Assignment 1 for some insight). Be sure to locate methods in the appropriate hierarchy. If functionality is common across all Entertainment" devices (such as change Volume()"), then put that in the Entertainment class. If something is unique to Television," then put it in that class Instantiate at least one instance of the following in your main program: Light, Music, Television, HVAC, Oven, Refrigerator, MotionSensor, and Camera. This should be in a new file called "SmartHome2.java" As with the previous assignment, allow users the ability to input specific commands. You should have at least 12 distinct commands of your choosing; however, one of them should be "Help." When the user types "Help," have the system print out all commands for reference. Each command (except for Help) should control one or more Smart Home devices. Include appropriate comments throughout your code. Remember to use standard Java naming conventions. Put your name and information about the program at the beginning of your program. Submit your Smart Home2.java, all other Class and Java files in your project, 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: 00 0 N N 1 import java.io.File; 2 import java.io.FileNotFoundException; 3 import java.util.Scanner; 4 5 public class SmartHome { 6 7 //main method 8 public static void main(String[] args) { 9 //instance variables 10 double temperature = 73; //Average Temperature 11 String ACSettings; //cool or heat 12 boolean isMusicon = false; 13 boolean istVon = false; 14 String song = null; //Select a song 15 String channel = ""; //Select a channel 16 boolean roomLights[] = { //Asume all lights are off when you get back home 17 false, //bedroom 18 false, //kitchen 19 false, //living room 20 false, //bathroom 21 false, //garage 22 }; 23 String roomNames [] { "bedroom", "kitchen", "living room", "bathroom", "garage"}; 24 25 26 //This scanner will be able to read all the user input 27 Scanner console = new Scanner(System.in); 28 29 //Default display message when u get home 30 System.out.println("Welcome home! What would you like to do?"); 31 32 while(true) { 33 String command console.nextLine(); //User will enter a new command 34 35 //Check for user command and perform action 36 if (command.equals("Select temperature")) { 37 System.out.println("What temperature would you like?"); 38 double newTemp = console.nextDouble(); = 0 0 3 0 0 + in = 39 console.nextLine(); 40 if(temperature > newTemp) { 41 ACSettings = "cool"; 42 System.out.println("Temperature is now: ACSettings); 43 temperature = newTemp; 44 } 45 else if(temperature

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 And Expert Systems Applications Dexa 2023 Workshops 34th International Conference Dexa 2023 Penang Malaysia August 28 30 2023 Proceedings

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Atif Mashkoor ,Johannes Sametinger ,Maqbool Khan

1st Edition

303139688X, 978-3031396885

More Books

Students also viewed these Databases questions