/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package theaterpeople; import java.io.File; /** * * @author jcmt */ public class TheaterPeople implements calculatePay { private String lastName; private String firstName; private dateDMY dateOfBirth; public TheaterPeople() { this.lastName = ""; this.firstName = ""; this.dateOfBirth = new dateDMY(1,1,1900); } public TheaterPeople(String lastName, String firstName, dateDMY dateOfBirth) { this.lastName = lastName; this.firstName = firstName; this.dateOfBirth = dateOfBirth; } public TheaterPeople(String lastName, String firstName, int day, int month, int year) { this.lastName = lastName; this.firstName = firstName; this.dateOfBirth = new dateDMY(day,month,year); } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public dateDMY getDateOfBirth() { return dateOfBirth; } public void setDateOfBirth(dateDMY dateOfBirth) { this.dateOfBirth = dateOfBirth; } public void setDateOfBirth(int day, int month, int year) { this.dateOfBirth = new dateDMY(day,month,year); } public String toString() { return String.format("%s %s, Date of birth %s", firstName, lastName, getDateOfBirth()); } @Override public double getCalculatedPay() { return this.getCalculatedPay(); } /* Potential subclasses * Actors, Director, Stagehands, Musicians, * Producers, Theaterstaff */ /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Actor JD = new Actor("Mercutio",17, 0, "Donne", "John",20, 2, 1980); Actor JG = new Actor("Dorothy", 8, 1, "Garland","Judy", 4, 7, 1902); Producer JL = new Producer("Executive", 150000000.0, 2, "Leto","Jared", 3, 3, 1986); Actor CG = new Actor(); Actor JM = new Actor("ActorsIn"); //System.out.println(JD); System.out.println(JG); System.out.println(CG); //JD.setHoursWorked(800); JG.setHoursWorked(240); //JL.setUpFrontFee(150000); //JL.setPercentageOfGross(.20); TheaterPeople[] tp = new TheaterPeople[3]; tp[0] = CG; tp[1] = JG; //tp[2] = JL; for (TheaterPeople t: tp) { try { System.out.printf("Person's pay is %f\n", t.getCalculatedPay()); } catch (ArithmeticException ae) { System.out.printf("Oops - %s", ae); } } } }