Create a class "faculty" with attributes like id, name, designation, emailid, birthdate, city. a. getData() to take faculty information. b. setData() to display faculty information. Inherit class “Account” with attributes like acc_id, acc_type, amount and methods to generate account report of particular faculty in proper format. - Pratik Ghelani

Pratik Ghelani

Breaking

Sunday, May 10, 2020

Create a class "faculty" with attributes like id, name, designation, emailid, birthdate, city. a. getData() to take faculty information. b. setData() to display faculty information. Inherit class “Account” with attributes like acc_id, acc_type, amount and methods to generate account report of particular faculty in proper format.

Input:-

class faculty(object):
    faculty_id=0
    faculty_name=""
    designation =""
    Email_id=""
    DOB =""
    City =""

    def set(self,faculty_id,faculty_name,designation,Email_id,DOB,City):
        self.faculty_id=faculty_id
        self.faculty_name=faculty_name
        self.designation=designation
        self.Email_id=Email_id
        self.DOB=DOB
        self.City=City
    def get(self):
        print()
        print("Teacher details:-")
        print("Teacher id:-",self.faculty_id)
        print("Teacher Name:-",self.faculty_name)
        print("designation:-",self.designation)
        print("Email id:-",self.Email_id)
        print("DOB:-",self.DOB)
        print("City:-",self.City)

class Account(faculty):
    acc_id=0
    acc_type=""
    amount=0

    def set(self,acc_id,acc_type,amount):
        self.acc_id=acc_id
        self.acc_type=acc_type
        self.amount=amount
    def get(self):
        print()
        print("Account details:-")
        print("Account id:-",self.acc_id)
        print("Account type:-",self.acc_type)
        print("Amount:-",self.amount)

m = faculty()
m.set(1,"Parth Shah","Assistant Professor","parthshah01@gmail.com","27/06/1993","Surat")
m.get()

h = Account()
h.set(2,"Saving Account",25000)

h.get()

Output:-


No comments:

Post a Comment