/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package theaterpeople; /** * * @author jcmt */ public class Actor extends TheaterPeople implements calculatePay { private String roleName; private int shirtSize; private int clothesGender; // 1 = female, 0= male; private double hoursWorked; public Actor(String roleName, int shirtSize, int clothesGender, String lastName, String firstName, dateDMY dateOfBirth) { super(lastName, firstName, dateOfBirth); this.roleName = roleName; this.shirtSize = shirtSize; this.clothesGender = clothesGender; } public Actor(String roleName, int shirtSize, int clothesGender, String lastName, String firstName, int day, int month, int year) { super(lastName, firstName, day, month, year); this.roleName = roleName; this.shirtSize = shirtSize; this.clothesGender = clothesGender; } public String getRoleName() { return roleName; } public void setRoleName(String roleName) { this.roleName = roleName; } public int getShirtSize() { return shirtSize; } public void setShirtSize(int shirtSize) { this.shirtSize = shirtSize; } public int getClothesGender() { return clothesGender; } public void setClothesGender(int clothesGender) { if ((clothesGender == 0) || (clothesGender == 1)) { this.clothesGender = clothesGender; } else { this.clothesGender = 1; } } public double getHoursWorked() { return hoursWorked; } public void setHoursWorked(double hoursWorked) { if (hoursWorked > 0) { this.hoursWorked = hoursWorked; } } @Override public double getCalculatedPay() { double equityPayPerHour = 8.75; int equityLevel = 2; return hoursWorked * equityPayPerHour + hoursWorked * (equityPayPerHour / equityLevel); } public String toString() { return String.format("%s in the role %s wears %s size %d", super.toString(), roleName, ((clothesGender == 1) ? "women's" : "men's"), shirtSize); } }