Skip to content

Instantly share code, notes, and snippets.

@mamiwinsfall93
Created January 18, 2020 17:18
Show Gist options
  • Select an option

  • Save mamiwinsfall93/73b4a00bdf58be9af1544fa446ecd5e8 to your computer and use it in GitHub Desktop.

Select an option

Save mamiwinsfall93/73b4a00bdf58be9af1544fa446ecd5e8 to your computer and use it in GitHub Desktop.

Revisions

  1. mamiwinsfall93 created this gist Jan 18, 2020.
    57 changes: 57 additions & 0 deletions JAVA
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,57 @@
    /** Filename: Employee.java
    * Author: Ndatta Fall

    * Purpose: Executive employee classes with salary information
    *
    */
    public class Executive extends Employee{

    private int stockPrice;

    public Executive(String name, int monthlySalary, int stockPrice) {

    super(name, monthlySalary);

    this.stockPrice = stockPrice;

    }

    public int AnnualSalary() {

    int bonus = 0;

    if(stockPrice > 50)

    bonus = 30000;

    int totalPay = (getMonthlySalary() * 12) + bonus;

    return totalPay;

    }

    public String toString() {// returns employee's information

    String employeeInfo = "employee's name: " + getName()

    + "\n" + "Monthly salary : " + getMonthlySalary()

    + "\n" + "Annual salary : " + AnnualSalary();

    return employeeInfo;

    }

    public int getStockPrice() {

    return stockPrice;

    }

    public void setStockPrice(int stockPrice) {

    this.stockPrice = stockPrice;

    }

    }