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

Using Java Create the SeniorAgent class: A senior agent is an agent that can ear

ID: 3822163 • Letter: U

Question

Using Java

Create the SeniorAgent class: A senior agent is an agent that can earn an additional commission (percentage of the sales they make each month) as a bonus if she/he meets their sales quota. SeniorAgent class extends the Agent class. The SeniorAgent class should have two constructors, appropriate get and set methods, a method to read Agent information from a file and a method to calculate the amount of bonus earned, i.e. if the agent met the quota how much will they be payed. Make sure to include the following fields: bonus: double, holds the percentage the agent will get. quota: double, holds the min amount to sale each month to earn a bonus

----------------- AGENT CLASS ----------------------

public class Agent

{

   // instance variable

private int agentID;

   private String agentName;

   private double payRate;

   private String hireDate;

   private String agentType;

   private double commissionRate;

// constructors

   public Agent() {

       agentID = 0;

       agentName = "";

       payRate= 0;

       hireDate = "";

       agentType = "retail";

       commissionRate = 0;

   }

   public Agent(int agentID, String agentName, double payRate, String hireDate, String agentType,

double commissionRate) {

this.agentID = agentID;

       this.agentName = agentName;

       this.payRate = payRate;

       this.hireDate = hireDate;

       this.agentType = agentType;

       this.commissionRate = commissionRate;

   }

   // getters and setters

public int getAgentID() {

       return agentID;

   }

public String getAgentName() {

       return agentName;

}

   public double getPayRate() {

       return payRate;

}

   public String getHireDate() {

       return hireDate;

}

public String getAgentType() {

       return agentType;

}

   public double getCommissionRate() {

       return commissionRate;

   }

   public void setAgentID(int agentID) {

       this.agentID = agentID;

}

public void setAgentName(String agentName) {

       this.agentName = agentName;

}

   public void setPayRate(double payRate) {

       this.payRate = payRate;

}

   public void setHireDate(String hireDate) {

       this.hireDate = hireDate;

}

public void setAgentType(String agentType) {

       this.agentType = agentType;

}

   public void setCommissionRate(double commissionRate) {

       this.commissionRate = commissionRate;

}

}

Explanation / Answer

Hi Friend, you have not mentioned about how data is stored in file, so i have not implemented that method.

All other requirement has been implemented.

public class SeniorAgent extends Agent {

  

   private double bonus;

   private double quota;

  

   public SeniorAgent() {

       bonus = 0;

       quota = 0;

   }

   public SeniorAgent(int agentID, String agentName, double payRate, String hireDate, String agentType,

           double commissionRate, double bonus, double quota) {

       super(agentID, agentName, payRate, hireDate, agentType, commissionRate);

       this.bonus = bonus;

       this.quota = quota;

   }

   public double getBonus() {

       return bonus;

   }

   public double getQuota() {

       return quota;

   }

   public void setBonus(double bonus) {

       this.bonus = bonus;

   }

   public void setQuota(double quota) {

       this.quota = quota;

   }

  

   // Method to calculate bonus if it meets minimum criteria

   public double bonusEarned(double sale){

      

       if(quota <= sale)

           return getPayRate()*bonus;

       else

           return 0;

   }

}

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