test/employee/employee.go

23 lines
477 B
Go

package employee
import (
"fmt"
)
type employee struct {
firstName string
lastName string
totalLeaves int
leavesTaken int
}
// New constructeur d'employee
func New(firstName string, lastName string, totalLeave int, leavesTaken int) (e employee) {
e = employee{firstName, lastName, totalLeave, leavesTaken}
return
}
func (e employee) LeavesRemaining() {
fmt.Printf("%s %s has %d leaves remaining \n", e.firstName, e.lastName, (e.totalLeaves - e.leavesTaken))
}