/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package theaterpeople; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; import javax.swing.JFrame; import javax.swing.JLabel; import java.awt.BorderLayout; /** * * @author jcmt */ public class TheaterPeople implements calculatePay { private String lastName; private String firstName; private dateDMY dateOfBirth; private double calculatedPay; 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 makeCalculatedPay() { return this.makeCalculatedPay(); } public void setCalculatedPay(double cPay) { if (cPay >= 0) { calculatedPay = cPay; } calculatedPay = 0; } public double getCalculatedPay() { return calculatedPay; } /* 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 MR = new Actor(); Actor JM; Actor JR; File inFile = new File("/Users/jcmt/UTA/ClassesOther/JavaSpring14/ActorsIn2.txt"); try { Scanner inputF = new Scanner(inFile); JM = new Actor(inputF); JR = new Actor(inputF); //Actor CG = new Actor(); } catch(FileNotFoundException f) { System.out.println("File does not exist"); JM = new Actor(); JR = new Actor(); } * */ JFrame appaint = new JFrame("painting"); PaintPanel pP = new PaintPanel(); appaint.add(pP, BorderLayout.CENTER); appaint.add(new JLabel("Drag mouse to draw"), BorderLayout.SOUTH); appaint.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); appaint.setSize(400, 200); appaint.setVisible(true); /* PersonWindow pw = new PersonWindow(); pw.showPersonWindow(); */ /* PersonWindow2 pw = new PersonWindow2(); pw.showPersonWindow2(); pw.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //setTitle("Person"); pw.setSize(350,150); pw.setVisible(true); */ /* * * System.out.printf("String from window is %s",pw.getMRString()); //MR.setFirstName(pw.getMRString()); //System.out.println(JD); System.out.println(JG); System.out.println(JL); System.out.println(JM); System.out.println(JR); //System.out.println(MR); //JD.setHoursWorked(800); JG.setHoursWorked(240); //JL.setUpFrontFee(150000); //JL.setPercentageOfGross(.20); TheaterPeople[] tp = new TheaterPeople[3]; tp[0] = JL; tp[1] = JG; tp[2] = JM; 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); } } */ } }