Skip to content

Instantly share code, notes, and snippets.

@mamiwinsfall93
Created January 18, 2020 17:18
Show Gist options
  • Save mamiwinsfall93/73b4a00bdf58be9af1544fa446ecd5e8 to your computer and use it in GitHub Desktop.
Save mamiwinsfall93/73b4a00bdf58be9af1544fa446ecd5e8 to your computer and use it in GitHub Desktop.
Purpose: Executive employee classes with salary information
/** 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