// CSE 142, Autumn 2009, Marty Stepp // A class to represent employees in general (20-page manual). // This version uses fields, constructors, and extra methods. public class Employee { private int years; // # of years with the company // Constructs an employee who has worked for the given number of years. public Employee(int years) { this.years = years; } // A new method. Returns the number of extra days of vacation // that the employee should be given due to years worked here. public int getVacationBonus() { return years * 2; } // A new method. Returns how many years the employee has worked here. public int getYears() { return years; } // Modified to use getVacationBonus, so that it can be overridden public int getVacationDays() { return 10 + getVacationBonus(); // start at 2 weeks' paid vacation } public int getHours() { return 40; // works 40 hours / week } public double getSalary() { return 50000.0; // base salary of $50,000.00 / year } public String getVacationForm() { return "yellow"; // use the yellow form } }