Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
+1 vote
1.9k views
in Computer by (72.4k points)

Pay roll information system: 

Declare the base class ’employee’ with employee’s number, name, designation, address, phone number. Define and declare the function getdata() and putdata() to get the employee’s details and print employee’s details. Declare the derived class salary with basic pay, DA, HRA, Gross pay, PF, Income tax and Net pay. 

Declare and define the function getdata() to call getdata() and get the basic pay. Define the function calculate() to find the net pay. Define the function display() to call putdata() and display salary details.

Create the derived class object. Read the number of employees. Call the function getdata() and calculate() to each employees. Call the display() function.

1 Answer

+1 vote
by (89.5k points)
selected by
 
Best answer

class employee (object):

# constructor to create an object

def init (self):

self.eno=0

self.name=‘ ’

self.designation=‘ ’

self.address = ‘ ’

self.phonenumber=0

def getdata(self):

self.eno=input(“Enter Employee Number”)

self.name=raw_input(“Enter Employee Name’)

self.designation=raw_input(“Enter Employee Designation”)

self.address = raw_input(“Enter Employee Address”)

self.phonenumber=input(“Enter Employee Phone Number”)

def putdata (self):

print “Employee Number”,self.eno

print “Employee Name”,self.name

print “Employee Designation”,self.designation

print “Employee Address”,self.address

print “Employee Phone Number”,self phonenumber

class salary (employee):

# Salary details

def_init_(self):

super(salaryself)._init_()

self.basic=0

self.DA=0

self.HRA=0

self.Gross=0

self.PF=0

self.tax=0

self.netpay=0

def getdatal(self): self.getdata()

self.basic=float(raw_input(“Enter the basic pay’’))

self.DA=float(raw_input(“Enter the DA”))

self.HRA=float(raw_input(“Enter the HRA))

self.PF = float(raw_input(“Enter the PF”))

def calculate(self):

self.Gross= self.basic+ self.FîRA + self.DA

if .self. Gross < 100000:

self.tax=0

elif self.Gross < 500000:

self.tax=self.Gross*0.10

elif self.Gross < 1000000:

self.tax=self.Gross*0.15

else:

self.tax=self.Gross*0.20

self.netpay= self.Gross – self.PF – self.tax

def display(self):

self.putdataO

print “Gross Income”,self.Gross

print “Tax “,self.tax

print “Net Income”,self.netpay

salaryobj =salary()

num = int(raw_input(“Enter no. of employees:-”))

for i in range(0,num):

salaryobj.getdatal()

salaryobj.calculate()

salaryobj.display()

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...