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