Facebook
From Paltry Bird, 5 Months ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 57
  1. class Employee:
  2.    
  3.     def __init__(self,name,pay):
  4.         self._name=name
  5.         self._pay=pay
  6.         self._email=self._name+".@gmail.com"
  7.         print("Inside Employee init method")
  8.        
  9.     def __str__(self):
  10.        
  11.         return("Name : "+self._name+" Email : "+self._email+" Pay : "+self._pay)
  12.        
  13.        
  14.        
  15.        
  16. from Employee import Employee
  17.  
  18. class Developer(Employee):
  19.    
  20.     def __init__(self,name,pay,prog_lang):
  21.    
  22.         self._prog_lang=prog_lang
  23.         super().__init__(name,pay)
  24.    
  25.     def __str__(self):
  26.         return(super().__str__()+" Programming Language : "+self._prog_lang)
  27.        
  28.        
  29.        
  30.        
  31.        
  32. from Employee import Employee
  33. from Developer import Developer
  34.  
  35. print("Creating an Employee Object")
  36. input_str = input("Enter Employee details in comma separated format\n")
  37. name, pay = input_str.split(",")
  38. employee = Employee(name, pay)
  39. print("Employee Details")
  40. print(employee)
  41.  
  42. print("\nCreating a Developer Object")
  43. input_str = input("Enter Developer details in comma separated format\n")
  44. name, pay, prog_lang = input_str.split(",")
  45. developer = Developer(name, pay, prog_lang)
  46. print("Developer Details")
  47. print(developer)
  48.  
  49.  
  50.  
  51.  
  52.