Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function FullTime() {
- this.hourly = "12";
- };
- function PartTime() {
- this.hourly = "6";
- };
- function Temporary() {
- this.hourly = "10";
- };
- function Contractor() {
- this.hourly = "15";
- };
- function Employee(type) {
- var result;
- if (type === "fulltime") {
- result = new FullTime();
- } else if (type === "parttime") {
- result = new PartTime();
- } else if (type === "temporary") {
- result = new Temporary();
- } else if (type === "contractor") {
- result = new Contractor();
- }
- result.type = type;
- result.say = function () {
- log.add(this.type + ": rate " + this.hourly + "/hour");
- }
- return result;
- }
- var employee = new Employee('parttime');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement