Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ch3;
- public class testemploy {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Employee bob = new Employee("Bob", 500.00);
- bob.getName();
- bob.getSalary();
- bob.raiseSalary(20);
- bob.getSalary();
- }
- }
- ****************************************************************************************************************************
- package ch3;
- public class Employee {
- private String name;
- private double moneyPaid;
- public Employee(String employeeName, double currentSalary){
- name = employeeName;
- moneyPaid = currentSalary;
- }
- public void getName(){
- System.out.println(name);
- }
- public void getSalary(){
- System.out.println(moneyPaid);
- }
- public void raiseSalary(double byPercent){
- double percent = byPercent;
- double wage = moneyPaid;
- moneyPaid = wage * (1 + percent/100);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment