Professional Documents
Culture Documents
DA = basic * 0.40
Gross Salary = basic + DA
Net Salary = Gross Salary - Tax Deduction
Tax Deduction is computed using below table:
'''
class Employee:
def netsal(self):
basic = self.sal
DA = float(basic) * 0.40
grosssal = basic + DA
taxded=0
if(grosssal>300000):
if(grosssal>500000):
if(grosssal>1000000):
taxded += (grosssal-1000000)*0.3
grosssal -= 1000000
taxded += (grosssal-500000)*0.2
grosssal -= 500000
taxded += (grosssal-300000)*0.1
grosssal -= 300000
return grosssal-taxded
if __name__ == "__main__" :
e1 = Employee('001', 'Samik', 700000)
e1.display()
'''Question 2
Dairy farm'''
class DairyProduct :
def __init__(self, *args) :
self.dairyId = int(args[0])
self.dairyBrand = args[1]
self.productType = args[2]
self.price = int(args[3])
self.grade = args[4]
class ProductGrade :
def __init__(self, *args) :
self.dairyList = args[0]
self.weightageDict = args[1]
if len(ans) :
return ans
else :
return None
if __name__ == "__main__" :
n1 = int(input())
dairyProducts = []
for i in range(n1) :
dId = input()
dBrand = input()
pType = input()
price = input()
grade = input().lower()
n2 = int(input())
weightageDict = {}
for i in range(n2) :
grade = input().lower()
value = int(input())
weightageDict[grade] = value
if rslt :
for item in rslt :
print("Dairy Brand:", item[0])
print("Price:", item[1])
else :
print("No dairy product found")
'''Question 3
Zero padded time'''
class Time:
def __init__ (self, *args):
self.hours = args[0]
self.minutes = args[1]
self.seconds = args[2]
if __name__ == '__main__':
t = Time(4,20,2)
t.disptime()
'''Question 4
Simple Inheritance
'''
class Person():
def __init__(self, name):
self.name = name
def getName(self):
return self.name
def isEmployee(self):
return False
class Employee(Person):
def isEmployee(self):
return True
emp = Person("Geek1")
print(emp.getName(), emp.isEmployee())
emp = Employee("Geek2")
print(emp.getName(), emp.isEmployee())
#Output:
#('Geek1', False)
#('Geek2', True)
'''Question 5
Banquet Hall
'''
class BanquetHall:
def __init__ (self, *args):
self.id = int(args[0])
self.name = args[1]
self.capacity = int(args[2])
self.prices = args[3]
self.amenities = args[4]
class HallMgmtSys:
def __init__ (self, *args):
self.bHallList = args[0]
if n<=hall.capacity:
if allAmen == 0:
continue
else:
PPP = hall.prices
bill = PPP
print(f"Taxable Bill = {bill}")
#print(f"Total Bill = {bill*1.13}")
break
if __name__=="__main__":
num = int(input("Number of halls: "))
ipHalls = []
for i in range(num):
hallID=input("Hall ID: ")
hallName=input("Hall Name: ")
hallCapacity=int(input("Hall Capacity: "))
hallPrices=[]
priceCount=int(input("Count of price inputs: "))
for j in range(priceCount):
PPP = [input("--price: "), input("--lowerlim "), input("--
upperlim ")]
hallPrices.append(PPP)
hallAmenities=[]
amenCount=int(input("Number of amenities: "))
for j in range(amenCount):
hallAmenities.append(input("--amenity: "))
HallList = HallMgmtSys(ipHalls)
HallList.billCalc(cap, amen)