Advertisement
Guest User

Untitled

a guest
Apr 21st, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. function FullTime() {
  2. this.hourly = "12";
  3. };
  4.  
  5. function PartTime() {
  6. this.hourly = "6";
  7. };
  8.  
  9. function Temporary() {
  10. this.hourly = "10";
  11. };
  12.  
  13. function Contractor() {
  14. this.hourly = "15";
  15. };
  16.  
  17. function Employee(type) {
  18. var result;
  19. if (type === "fulltime") {
  20. result = new FullTime();
  21. } else if (type === "parttime") {
  22. result = new PartTime();
  23. } else if (type === "temporary") {
  24. result = new Temporary();
  25. } else if (type === "contractor") {
  26. result = new Contractor();
  27. }
  28. result.type = type;
  29. result.say = function () {
  30. log.add(this.type + ": rate " + this.hourly + "/hour");
  31. }
  32. return result;
  33. }
  34.  
  35.  
  36.  
  37.  
  38. var employee = new Employee('parttime');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement