Posted By

trusktr on 11/19/10


Tagged

cisp401


Versions (?)

cisp401 PiecedEmployee.java


 / Published in: Java
 

  1. import java.util.*;
  2.  
  3. public class PiecedEmployee extends Employee {
  4.  
  5. // Data Objects (
  6. public Number pieces, piecerate;
  7. // )
  8. // Constructors (
  9. public PiecedEmployee() { //dflt
  10. super();
  11. pieces = new Number(0);
  12. piecerate = new Number(0);
  13. }
  14. public PiecedEmployee(String f, String l, double pcs, double pcr) { //param
  15. super(f, l);
  16. pieces = new Number(pcs);
  17. piecerate = new Number(pcr);
  18. }
  19. public PiecedEmployee(MyString f, MyString l, Number pcs, Number pcr) { //param
  20. super(f, l);
  21. pieces = new Number(pcs);
  22. piecerate = new Number(pcr);
  23. }
  24. public PiecedEmployee(EmployeeData d) { //generic data, no specific data
  25. super(d);
  26. pieces = new Number(0);
  27. piecerate = new Number(0);
  28. }
  29. public PiecedEmployee(PiecedEmployee e) { //copy
  30. super(e.info());
  31. pieces = new Number(pieces());
  32. piecerate = new Number(pieceRate());
  33. }
  34. // )
  35. // Accessors (
  36. public Number pieces() {
  37. return new Number(pieces);
  38. }
  39. public Number pieceRate() {
  40. return new Number(piecerate);
  41. }
  42. public Number grossPay() {
  43. return pieces() .times (pieceRate());
  44. }
  45. // )
  46. // Mutators (
  47. // )
  48. }

Report this snippet  

You need to login to post a comment.