001 package classwork;
002 /**
003 * Models and computes the paycheck of an employee.
004 * @author Tom James
005 *
006 */
007 public class Paycheck {
008 /**
009 * @param name The name of the employee.
010 * @param wage The hourly wage of the employee.
011 * @param hours How many hours the employee worked.
012 */
013 public Paycheck(String name,double wage,double hours) {
014 this.name = name;
015 this.wage = wage;
016 this.hours = hours;
017 }
018 /**
019 * @return How much money the employee has earned.
020 */
021 public double getCash() {
022 double cash,extra = 0;
023 cash = wage * hours;
024 if (hours > 40) {
025 extra = (hours - 40) * wage * 1.5;
026 }
027 return (cash + extra);
028 }
029 /**
030 * @return The name of the employee.
031 */
032 public String getName() {
033 return name;
034 }
035 /**
036 * The name of the employee.
037 */
038 private String name;
039 /**
040 * The hourly wage of the employee.
041 */
042 private double wage;
043 /**
044 * How many hours the employee has worked.
045 */
046 private double hours;
047 }