Answer to Question #292608 in Python for dv13

Question #292608

 4. Create a class SalariedEmployee  


a. SalariedEmployee class is a child class of Employee class. It should inherit all the attributes of 

Employee class and add its own attribute baseSalary. 


b. Create a method called CalculateNetSalary which should deduct 13% Provisional Tax, 1% 

insurance and 3% Fed Tax from baseSalary and display the NetSalary.  


c. Create a method called displayData which should display the FirstName, LastName, Age, 

Address, ContactNumber, EmployeeID, OrganizationName, Position, baseSalary and 

NetSalary.  



1
Expert's answer
2022-02-01T04:13:48-0500
class Employee:
    FirstName = ''
    LastName = ''
    Age = 0
    Address = ''
    ContactNumber = ''
    EmployeeID = ''
    OrganizationName = ''
    Pozition = ''

class SalariedEmployee(Employee):
    baseSalary = 0

    def CalculateNetSalary(self):
        self.NetSolary = self.baseSalary * (100 - 13 - 1 - 3)/100
        print('NetSolary = ', self.NetSolary)

    def displayData(self):
        print( f'FirstName: {self.FirstName}',
               f'LastName: {self.LastName}',
               f'Age: {self.Age}',
               f'Address: {self.Address}',
               f'ContactNumber: {self.ContactNumber}',
               f'EmployeeID: {self.EmployeeID}',
               f'OrganizationName: {self.OrganizationName}',
               f'Pozition: {self.Pozition}',
               f'baseSolary: {self.baseSalary}',
               f'NetSolary: {self.NetSolary}',
               sep='\n')

Tom = SalariedEmployee()
Tom.FirstName = 'Tom'
Tom.LastName = 'Cruse'
Tom.baseSalary = 5000
Tom.Age = 25
Tom.Address = 'Paris'
Tom.ContactNumber = '123945687'
Tom.EmployeeID = '4561987534562315'
Tom.OrganizationName = 'Bosch'
Tom.Pozition = 'Full Stack Engineer'
Tom.CalculateNetSalary()
Tom.displayData()

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS