-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSalariedEmployee.java
More file actions
27 lines (23 loc) · 831 Bytes
/
SalariedEmployee.java
File metadata and controls
27 lines (23 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package sample;
import javax.swing.*;
import java.io.Serializable;
public class SalariedEmployee extends Employee implements Serializable {
public double monthlySalary;
public SalariedEmployee(String name,String id,String designation,double monthlySalary){
super(name,id,designation);
this.monthlySalary=monthlySalary;
}
public void increaseSalary(double amt) throws InvalidSalaryException {
if(amt<0){
throw new InvalidSalaryException("Increase Amount should be a positive number!");
}
monthlySalary+=amt;
}
public double getSalary(){
return monthlySalary;
}
public void display(){
super.display();
//JOptionPane.showMessageDialog(null," Monthly Salary: "+monthlySalary,"Display",JOptionPane.PLAIN_MESSAGE);
}
}