Create a parent class called “Home.” 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 “Home”. 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. Be
sure to locate methods in the appropriate hierarchy. If functionality is common across all “Entertainment” devices, 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 "Home.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 should control one or more devices.

Respuesta :

Create a parent class called “Home.” 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 “Home”. 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.

Explanation:

import java.util.Scanner;

class Home {       private int rooms;     private boolean balcony;      

   public Home(){       rooms = 3;

  public class DataInput {

     public static void main(String [] args) {

        Scanner scan = new Scanner(System.in);

        String firstName;

        int age;

        float gpa;

System.out.print("Please enter your first name: ");

        firstName = scan.next();

        System.out.print("Please enter your age as an integer: ");

        age = scan.nextInt();

        System.out.print("Please enter your GPA: ");

        gpa=scan.nextFloat();

     }

class House {

}

public class Main {

   public static void main(String[] args) {

       House property;

   }

package departmentstore1;

public class DepartmentStore {

   long itemNumber;

   char category;

   String itemName;

   double unitPrice;

}

public class Main {

   public static void main(String[] args) {

       House property = new House();

       

       property.propertyNumber = 283795;

       property.propertyType = "Single Family";

       property.Bedrooms = 4;

       property.MarketValue = 652880;

       

       System.out.println("=//= Altair Realty =//=");

       System.out.println("Properties Inventory"); ;

       System.out.println("Property #: " + property.propertyNumber);

       System.out.println("Property Type: " + property.propertyType);

       System.out.println("Bedrooms: " + property.Bedrooms);

       System.out.println("Market Value: " + property.MarketValue);

   }

}

}

  }