micher43

E3.8 (Employee)

Oct 1st, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.42 KB | None | 0 0
  1. public class Employee {
  2.    
  3.     private String name;
  4.     private double salary;
  5.    
  6.     /**
  7.      * constructor
  8.      */
  9.     public Employee(String employeeName, double currentSalary){
  10.         name = employeeName;
  11.         salary = currentSalary;
  12.     }
  13.    
  14.     public String getName(){
  15.         return name;
  16.     }
  17.    
  18.     public double getSalary(){
  19.         return salary;
  20.     }
  21.    
  22.     public void raiseSalary(double byPercent){
  23.         salary = (salary * (byPercent / 100)) + salary;
  24.     }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment