Employee

Employee - + " " +...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
public class Employee{ private String name; private int payRate; private Department dept; public Employee(Department dep, String empName, int pay){ name = empName; payRate = pay; dept = dep; } public int weeklyPay(int hours){ int grossPay = payRate * hours; return grossPay - taxes(grossPay); } public int taxes(int pay){ return (int) (pay * .25); } public String bossName( ){ return (dept . getManager( )) . name; } public void printStub(int hours){ IO.outputStringAnswer(name + " " + hours
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: + " " + weeklyPay(hours) + " " + bossName( )); } public static void main(String args){ Department toyDept = new Department("toys"); Employee joe = new Employee(toyDept, "Joe Smith", 10000); Employee sue = new Employee(toyDept, "Sue Jones", 5000); Employee sam = new Employee(toyDept, "Sam Baker", 2500); toyDept.setManager(joe); sue.printStub(40); sam.printStub(50); } }...
View Full Document

Ask a homework question - tutors are online