Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java please Buyer Class: Implement a class called Buyer that represents a client

ID: 3723293 • Letter: J

Question

Java please

Buyer Class: Implement a class called Buyer that represents a client of a real estate agency. Each Buyer object should keep track of its own name, address, phone number, and the mls number of the home purchased (assume only one has been purchased). As a result, the Buyer class defines four private instance fields or variables: name, address, and phoneNumber (all of type String) and a mlsNumber which is an int. Implement the following instance methods in the Buyer class: public methods used to access and protected methods used to modify the instance fields or variables, i.e, get and set methods, respectively toString0 method that returns an instance of a String containing the Buyer object's name and address, e.g., "Laura Wade, 123 main street, Highland, IN". a constructor that accepts a String for the name of the Buyer object, a String for the address of the Buyer object, and a String for the phone number of the Buyer object. a . a zero-argument constructor (i.e., one that takes no arguments) that sets the Buyer object's name to "name unknown", the Buyer object's address to "address unknown", and the Buyer object's phone number to "phone number unknown'

Explanation / Answer

** Class Of Buyer

public class Buyer {

private String name, address, phoneNumber;
private int mlsNumber;

/**
* Default Constructor which stores default values accoring to your requirement.
*/
public Buyer() {
this.name = "name unknown";
this.address = "address unknown";
this.phoneNumber = "phone number unknown";
}

/**
* Default Constructor which stores values to the object.
* @param name Name of the buyer.
* @param address Address of the buyer.
* @param phoneNumber Phonenumber of the buyer.
*/
public Buyer(String name, String address, String phoneNumber) {
this.name = name;
this.address = address;
this.phoneNumber = phoneNumber;
}

public String getName() {
return name;
}

protected void setName(String name) {
this.name = name;
}

public String getAddress() {
return address;
}

protected void setAddress(String address) {
this.address = address;
}

public String getPhoneNumber() {
return phoneNumber;
}

protected void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}

public int getMlsNumber() {
return mlsNumber;
}

protected void setMlsNumber(int mlsNumber) {
this.mlsNumber = mlsNumber;
}

/**
* This method returns string representation of the degree in specific format.
* @return String String format of name and address.
*/
@Override
public String toString() {
return this.getName() + ", " + this.getAddress();
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote