#!/usr/bin/python3
#======================================================================================
# The user program
#======================================================================================
import sys                                              
sys.path.insert(0,'/home/s/sultans/web/python/demo/oo/employee')
from Employee import Employee

print("Content-type: text/html \n")             #required HTTP response header


co    = Employee.companyName                    #access static field
count = Employee.employeeCount

Employee.companyInfo()                          #call a static method

e1 = Employee("Dir","Sultan","Sam","M",45)      #instantiate/create objects
e2 = Employee("Mgr","Smith","Mary","F",35)  
e3 = Employee("Sec","Stevens","Bob","M",28)
x  = Employee("???","Person","Mystery","",0)

fname = e1.firstname                            #access instance field
print("First Name: " + fname)                   #prints  First Name: Sam

x.firstname = "Harry"                           #changing instance fields
x.lastname  = "Potter"

print("After change: " + x.firstname +" "+ x.lastname)    #prints Harry Potter


count = Employee.getEmployeeCount( )           #call static method
print("Number of employees: ", count)          #prints  Number Employees: 4

name1 = e1.getFullname("Mr.")                  #call instance method 
print(name1)                                   #prints:  Mr. Sam Sultan

print(e2.getFullname("Ms."))                   #combining 2 previous. lines

print(e3.__str__())                            #call the __str__() method

print(x)                                       #when an obj. is used in string context
                                               #no need to say  .__str__( )
                                               
Employee.employeeCount += 10                   #I can destroy the integrity of the variable

print("Number of employees now:", Employee.employeeCount) 




                                               
                                               
#=== link to see the python code =================================================
import os, sys
sys.path.insert(0,'/home/s/sultans/web/python/demo')
import zCode                          #import func to display the Python code
filename = os.path.abspath(__file__)  #get absolute file name 
zCode.display(filename)               #call it
#=================================================================================