Java please. Home Class Implement a class called Home that represents a home bei
ID: 3723296 • Letter: J
Question
Java please.
Home Class Implement a class called Home that represents a home being sold by a real estate agency. Each Home object should keep track of its own location, model, year of building, number of potential buyers, address, mls number, price, and availability. As a result, the Home class defines eight private instance fields or variables. Three of these instance variables or fields - location, model. and address - are of type String. The availability is of type boolean and indicates whether or not the home was sold. Three of these instance variables or fields - year, mlsNumber, and noOfPotentialBuyers - are of type int, while the remaining instance variable or field, price, is of type double Implement the following instance methods in the Home class public methods used to access and protected methods used to modify the instance fields or variables, i.e, get and set methods, respectively a toString0 method that returns an instance of a String containing the Home object's location, model, and address, e.g., "port de leau 2 bdrm condo at 123 45th street, Highland, IN" . . a constructor that accepts a String for the location of the Home object, a String for the model of the Home object, a String for the address of the Home object, an int for the year of building of the Home object, an int for the number of potential buyers of the Home object, and an int for the mls number of the Home object. The availability instance variable should be initialized to trueExplanation / Answer
Home.java
public class Home {
private String location, model, address;
private boolean availability;
private int year, mlsNumber, noOfPotentialBuyers;
private double price;
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public boolean isAvailability() {
return availability;
}
public void setAvailability(boolean availability) {
this.availability = availability;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public int getMlsNumber() {
return mlsNumber;
}
public void setMlsNumber(int mlsNumber) {
this.mlsNumber = mlsNumber;
}
public int getNoOfPotentialBuyers() {
return noOfPotentialBuyers;
}
public void setNoOfPotentialBuyers(int noOfPotentialBuyers) {
this.noOfPotentialBuyers = noOfPotentialBuyers;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public String toString() {
return location+" "+model+" at "+address;
}
public Home(String location, String model, String address, int year, int noOfPotentialBuyers,int mlsNumber) {
this.location = location;
this.model=model;
this.address=address;
this.year = year;
this.noOfPotentialBuyers=noOfPotentialBuyers;
this.mlsNumber=mlsNumber;
availability=true;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.