Duplicate Question
The question on this page has been marked as a duplicate question.
Original Question
Design a console application that will print an estate agent property sale commission report. Use an abstract class named Estat...Question
Design a console application that will print an estate agent property sale commission report. Use
an abstract class named EstateAgent that contains variables to store the estate agent's name and
property price. Create a constructor accepting the estate agent's name and property price as
parameters. In this class, also create get methods to get the estate agent name, property price
and estate agent commission. The agent commission is calculated at 20% of the property sale
price. The EstateAgent class must implement an iEstateAgent interface that contains the
following:
public interface iEstateAgent
{
String getAgentName();
double getPropertyPrice();
double getAgentCommission();
}
Create a subclass called EstateAgentSales that extends the EstateAgent class. The
EstateAgentSales class must contain a constructor to accept the estate agent name and the
property sale amount as parameters. Write code for the printPropertyReport method, which
prints the estate agent name, property sale price and the estate agent commission amount.
Finally, write a RunApplication class to instantiate the EstateAgentSales class. Sample output is
shown below, and you may use the same values to test your application.
an abstract class named EstateAgent that contains variables to store the estate agent's name and
property price. Create a constructor accepting the estate agent's name and property price as
parameters. In this class, also create get methods to get the estate agent name, property price
and estate agent commission. The agent commission is calculated at 20% of the property sale
price. The EstateAgent class must implement an iEstateAgent interface that contains the
following:
public interface iEstateAgent
{
String getAgentName();
double getPropertyPrice();
double getAgentCommission();
}
Create a subclass called EstateAgentSales that extends the EstateAgent class. The
EstateAgentSales class must contain a constructor to accept the estate agent name and the
property sale amount as parameters. Write code for the printPropertyReport method, which
prints the estate agent name, property sale price and the estate agent commission amount.
Finally, write a RunApplication class to instantiate the EstateAgentSales class. Sample output is
shown below, and you may use the same values to test your application.
Answers
There are no human answers yet.
Answered by
GPT 3.5
Here is the code for the console application that prints an estate agent property sale commission report:
```java
// Abstract class EstateAgent
abstract class EstateAgent {
protected String agentName;
protected double propertyPrice;
public EstateAgent(String agentName, double propertyPrice) {
this.agentName = agentName;
this.propertyPrice = propertyPrice;
}
public String getAgentName() {
return agentName;
}
public double getPropertyPrice() {
return propertyPrice;
}
public double getAgentCommission() {
return propertyPrice * 0.2;
}
}
// Interface iEstateAgent
public interface iEstateAgent {
String getAgentName();
double getPropertyPrice();
double getAgentCommission();
}
// Subclass EstateAgentSales
class EstateAgentSales extends EstateAgent implements iEstateAgent {
public EstateAgentSales(String agentName, double propertyPrice) {
super(agentName, propertyPrice);
}
public void printPropertyReport() {
System.out.println("Estate Agent Name: " + getAgentName());
System.out.println("Property Sale Price: " + getPropertyPrice());
System.out.println("Estate Agent Commission: " + getAgentCommission());
}
}
// RunApplication class
public class RunApplication {
public static void main(String[] args) {
EstateAgentSales agentSales = new EstateAgentSales("John Smith", 250000.0);
agentSales.printPropertyReport();
}
}
```
Sample Output:
```
Estate Agent Name: John Smith
Property Sale Price: 250000.0
Estate Agent Commission: 50000.0
```
```java
// Abstract class EstateAgent
abstract class EstateAgent {
protected String agentName;
protected double propertyPrice;
public EstateAgent(String agentName, double propertyPrice) {
this.agentName = agentName;
this.propertyPrice = propertyPrice;
}
public String getAgentName() {
return agentName;
}
public double getPropertyPrice() {
return propertyPrice;
}
public double getAgentCommission() {
return propertyPrice * 0.2;
}
}
// Interface iEstateAgent
public interface iEstateAgent {
String getAgentName();
double getPropertyPrice();
double getAgentCommission();
}
// Subclass EstateAgentSales
class EstateAgentSales extends EstateAgent implements iEstateAgent {
public EstateAgentSales(String agentName, double propertyPrice) {
super(agentName, propertyPrice);
}
public void printPropertyReport() {
System.out.println("Estate Agent Name: " + getAgentName());
System.out.println("Property Sale Price: " + getPropertyPrice());
System.out.println("Estate Agent Commission: " + getAgentCommission());
}
}
// RunApplication class
public class RunApplication {
public static void main(String[] args) {
EstateAgentSales agentSales = new EstateAgentSales("John Smith", 250000.0);
agentSales.printPropertyReport();
}
}
```
Sample Output:
```
Estate Agent Name: John Smith
Property Sale Price: 250000.0
Estate Agent Commission: 50000.0
```
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.