Skip to content

Instantly share code, notes, and snippets.

@Pasanpr
Created August 17, 2016 17:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pasanpr/f9f22476e36f3c8d35fcd103b98bc118 to your computer and use it in GitHub Desktop.
Save Pasanpr/f9f22476e36f3c8d35fcd103b98bc118 to your computer and use it in GitHub Desktop.
import Foundation
enum EmployeeType {
case Manager
case NotManager
}
class Employee {
let name: String
let address: String
let startDate: NSDate
let type: EmployeeType
var department: String?
var reportsTo: String?
init(fullName: String, employeeAddress: String, employeeStartDate: NSDate, employeeType: EmployeeType) {
self.name = fullName
self.address = employeeAddress
self.startDate = employeeStartDate
self.type = employeeType
}
func pay() -> (basePay: Double, benefits: Double, deductions: Double, vacationTime: Int) {
return (0, 0, 0, 0)
}
}
func payEmployee (employee: Employee) {
let paycheck = employee.pay()
}
class HourlyEmployee: Employee {
var hourlyWage: Double = 15.00
var hoursWorked: Double = 0
let availableVacation = 0
override func pay() -> (basePay: Double, benefits: Double, deductions: Double, vacationTime: Int) {
return (hourlyWage * hoursWorked, 0, 0, availableVacation)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment