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);
}
}
}
}