-
-
Save mamiwinsfall93/73b4a00bdf58be9af1544fa446ecd5e8 to your computer and use it in GitHub Desktop.
Purpose: Executive employee classes with salary information
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** 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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment