001 package market;
002
003 import data.IntegerValue;
004 import data.Value;
005
006 /**
007 * A market's staffer. Can be warehouse worker, seller or manager.
008 */
009 public class UStaffer extends UPerson {
010
011 /**
012 * ID for serialization.
013 */
014 private static final long serialVersionUID = -3547390406005177394L;
015
016 public static final String SELLER = new String("Kassierer");
017 public static final String WAREHOUSE_WORKER = new String("Lagerarbeiter");
018 public static final String MANAGER = new String("Manager");
019
020 private IntegerValue ivSalary;
021 private String qualification;
022
023 /**
024 * Creates a new UStaffer.
025 * @param userName the staffer's ID.
026 */
027 public UStaffer(String userName, String qualification){
028 super(userName);
029 this.qualification = qualification;
030 }
031
032 /**
033 * Sets the staffer's salary.
034 * @param salary the salary to be set.
035 */
036 public void setSalary(int salary) {
037 IntegerValue iv = new IntegerValue(salary);
038 ivSalary = iv;
039 }
040
041 /**
042 * Gets the staffer's salary.
043 * @return the salary.
044 */
045 public IntegerValue getSalary() {
046 return ivSalary;
047 }
048
049 /**
050 * Gets the staffer's qualification.
051 * @return the qualification.
052 */
053 public String getQualification(){
054 return qualification;
055 }
056
057 /**
058 * Sets the staffer's qualification.<br>
059 * Can be warehouse worker, seller or manager.
060 * @param s the qualification's denotation.
061 */
062 public void setQualification(String s) {
063 qualification = s;
064 }
065
066 /**
067 * Computes and returns the money a staffer gets, if he or she is dismissed.
068 * @return the dismissal compensation.
069 * @see Options
070 */
071 public Value computeDismissalCompensation() {
072 Options o = SMarket.getOptions();
073 return ivSalary.multiply(getMonthsOfMembership()*o.getTimeOfEmployment()*o.getFractionOfWages());
074 }
075 }