Question

ASAP Please. Python Program Description Create an object-oriented program that allows you to enter data for...

ASAP Please.

Python Program

Description

Create an object-oriented program that allows you to enter data for employees.

Specifications

  • Create an abstract Employee class that provides private attributes for the first name, last name, email address, and social security number. This class should provide functions that set and return the employee’s first name, last name, email address, and social security number. This class has a function: get_net_income which returns 0.
  • Create a Manager class that inherits the Employee class. This class should add private attributes for years of experience and the annual salary. This class should also provide necessary set and get functions. It should add a bonus ($1,000/year of experience) to the annual salary. The income tax rate should be 30%. This class should override the get_net_income function of the Employee class. Note that the gross income is calculated as follows:
    • bonus = years of experience * 1000
    • gross income = annual salary + bonus
    • tax rate = 30%
    • income tax = gross income * tax rate
    • net income = gross income - income tax
  • Create a Representative class that inherits the Employee class. This class should add private attributes for the weekly hours of work and the pay rate. This class should also provide necessary set and get functions. The income tax rate should be 20%. This class should override the get_net_income function of the Employee class. Note that the gross income is calculated as follows:
    • gross income = weekly hours of work * 52 * pay rate
    • tax rate = 20%
    • income tax = gross income * tax rate
    • net income = gross income - income tax
  • In the main function, the program should create Manager or Representative objects from the data entered by the user and save them in a list named employees. After the user has terminated data entries, your program should display the information of all employees on the output with this format: last name, first name, email, social security number, net income.

Sample Output (Your output should be similar to the text in the following box)

Welcome to my app

EMPLOYEE DATA ENTRY

Manager or Representative? (m/r): d

Invalid selection.

Continue? (y/n): y

Manager or Representative? (m/r): m

First Name: Frank
Last Name: Wilson
Email Address: [email protected]
SSN: 111-22-3333
Years of Experience: 3
Annual Salary: 95000

Continue? (y/n): y

Manager or Representative? (m/r): r

First Name: John
Last Name: Atkins
SSN: 222-33-4444
Email Address: [email protected]
Weekly Hours of Work: 40
Pay Rate: 20

Continue? (y/n): n

EMPLOYEE INFORMATION
Wilson, Frank, [email protected], 111-22-3333, $68600.00
Atkins, John, [email protected], 222-33-4444, $33280.00

Thank you for using my app

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code is as follows:

*********************************************************************************************************************************************

from abc import ABC, abstractmethod
class Employee(ABC):
def __init__(self,firstName,lastName,emailId,socialSecNumber):
self.__firstName = firstName
self.__lastName = lastName
self.__emailId = emailId
self.__socialSecNumber = socialSecNumber
def getFirstName(self):
return self.__firstName
def setFirstName(self,firstName):
self.__firstName = firstName
def getLastName(self):
return self.__lastName
def setLastName(self,lastName):
self.__lastName = lastName
def getEmailId(self):
return self.__emailId
def setEmailId(self,emailId):
self.__emailId = emailId
def getSocialSecNumber(self):
return self.__socialSecNumber
def setSocialSecNumber(self,socialSecNumber):
self.__socialSecNumber = socialSecNumber
  
@abstractmethod
def get_net_income(self):
return 0
  
class Manager(Employee):
def __init__(self,firstName,lastName,emailId,socialSecNumber,yearsOfExperience,annualSalary):
super().__init__(firstName,lastName,emailId,socialSecNumber)
self.__yearsOfExperience = yearsOfExperience
self.__annualSalary = annualSalary
def getYearsOfExperience(self):
return self.__yearsOfExperience
def setYearsOfExperience(self,yearsOfExperience):
self.__yearsOfExperience = yearsOfExperience
def getAnnualSalary(self):
return self.__annualSalary
def setAnnualSalary(self,annualSalary):
self.__annualSalary = annualSalary
def get_net_income(self):
bonus = self.__yearsOfExperience*1000
grossIncome = self.__annualSalary+bonus
tax_rate = 0.3
income_tax = grossIncome * tax_rate
net_income = grossIncome - income_tax
return net_income


class Representative(Employee):
def __init__(self,firstName,lastName,emailId,socialSecNumber,weeklyHoursOfWork,payRate):
super().__init__(firstName,lastName,emailId,socialSecNumber)
self.__weeklyHoursOfWork = weeklyHoursOfWork
self.__payRate = payRate
def getWeeklyHoursOfWork(self):
return self.__weeklyHoursOfWork
def setWeeklyHoursOfWork(self,weeklyHoursOfWork):
self.__weeklyHoursOfWork = weeklyHoursOfWork
def getPayRate(self):
return self.__payRate
def setPayRate(self,payRate):
self.__payRate = payRate
def get_net_income(self):
gross_income = self.__weeklyHoursOfWork * 52 * self.__payRate
tax_rate = 0.2
income_tax = gross_income * tax_rate
net_income = gross_income - income_tax
return net_income


print('Welome to my app')
print('EMPLOYEE DATA ENTRY')
employees = []
cont = 'y'
while(cont == 'y'):
choice = input('Manager or Representative? (m/r):')
while(choice!='m' and choice != 'r'):
print('Invalid selection.')
cont = input('Continue? (y/n):')
if(cont=='y'):
choice = input('Manager or Representative? (m/r):')
else:
cont = 'n'
break
  
if(cont=='y'):
firstName = input("First Name:")
lastName = input('Last Name:')
emailId = input('Email Address:')
socialSecNumber = input('SSN:')
if(choice=='m'):
yearsOfExperience = int(input('Years of Experience:'))
annualSalary = float(input('Annual Salary:'))
a = Manager(firstName,lastName,emailId,socialSecNumber,yearsOfExperience,annualSalary)
employees.append(a)
if(choice=='r'):
weeklyHoursOfWork = int(input('Weekly Hours of Work:'))
payRate = float(input('Pay Rate:'))
a = Representative(firstName,lastName,emailId,socialSecNumber,weeklyHoursOfWork,payRate)
employees.append(a)
cont = input('Continue? (y/n):')
print('EMPLOYEE INFORMATION')
if(employees == []):
print('There is nothing to print')
else:
for emp in employees:
print(emp.getLastName()+','+emp.getFirstName()+','+emp.getEmailId()+','+emp.getSocialSecNumber()+', $'+str(emp.get_net_income()))
print('Thank you for using my app')

*********************************************************************************************************************************************

screenshot of the code:

Output:

Add a comment
Know the answer?
Add Answer to:
ASAP Please. Python Program Description Create an object-oriented program that allows you to enter data for...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This is for Java Programming Please use comments Customer and Employee data (15 pts) Problem Description:...

    This is for Java Programming Please use comments Customer and Employee data (15 pts) Problem Description: Write a program that uses inheritance features of object-oriented programming, including method overriding and polymorphism. Console Welcome to the Person Tester application Create customer or employee? (c/e): c Enter first name: Frank Enter last name: Jones Enter email address: frank44@ hot mail. com Customer number: M10293 You entered: Name: Frank Jones Email: frank44@hot mail . com Customer number: M10293 Continue? (y/n): y Create customer...

  • Use python to create this program. 1) Employee Class Write an Employee class that keeps data...

    Use python to create this program. 1) Employee Class Write an Employee class that keeps data attributes for the following pieces of information: Note: For all classes, the attributes must be hidden Employee Name Employee Number Hire Date Create accessors and mutators Attributes should be hidden. Create a class attribute that determines a standard pay rate adjustment 4% for raises 2) ProductionWorker Class Write a class named ProductionWorker that is a subclass of Employee that holds the following attributes .Shift...

  • The purpose of this lab is to practice the concept of inheritance. We will create an...

    The purpose of this lab is to practice the concept of inheritance. We will create an Hourly class that is an Employee class. In other words, the Hourly class inherits from the Employee class. In addition, we will create a Salary class that inherits from the Employee class. Finally, we will make a Child class work as a Parent class. We will create a Manager class that inherits from the Salary class. Create a C++ project, and call it Week...

  • Description Create an object-oriented program that uses inheritance to perform calculations on a rectangle or a...

    Description Create an object-oriented program that uses inheritance to perform calculations on a rectangle or a square. Sample Output (Your output should be similar to the text in the following box) Rectangle Calculator Rectangle or square? (r/s): r Height: 5 Width: 10 Perimeter: 30 Area: 50 Continue? (y/n): y Rectangle or square? (r/s): s Length: 5 Perimeter: 20 Area: 25 Continue? (y/n): n Thank you for using my app Specifications Use a Rectangle class that provides attributes to store the...

  • write in java and please code the four classes with the requirements instructed You will be...

    write in java and please code the four classes with the requirements instructed You will be writing a multiclass user management system using the java. Create a program that implements a minimum of four classes. The classes must include: 1. Employee Class with the attributes of Employee ID, First Name, Middle Initial, Last Name, Date of Employment. 2. Employee Type Class that has two instances of EmployeeType objects: salaried and hourly. Each object will have methods that calculates employees payrol...

  • Part (A) Note: This class must be created in a separate cpp file Create a class...

    Part (A) Note: This class must be created in a separate cpp file Create a class Employee with the following attributes and operations: Attributes (Data members): i. An array to store the employee name. The length of this array is 256 bytes. ii. An array to store the company name. The length of this array is 256 bytes. iii. An array to store the department name. The length of this array is 256 bytes. iv. An unsigned integer to store...

  • Create an abstract class Employee. Your Employee class should include the following attributes: First name (string)...

    Create an abstract class Employee. Your Employee class should include the following attributes: First name (string) Last name (string) Employee id (string) Employee home street address (string) Employee home city (string) Employee home state (string) Write a constructor to initialize the above Employee attributes. Create an abstract method called earnings.      Create another class HourlyEmployee that inherits from the abstract Employee class.   HourEmployee must use the inherited parent class variables and add in attributes HourlyRate and HoursWorked. Your HourEmployee class should...

  • Create an abstract class Employee. Your Employee class should include the following attributes: First name (string)...

    Create an abstract class Employee. Your Employee class should include the following attributes: First name (string) Last name (string) Employee id (string) Employee home street address (string) Employee home city (string) Employee home state (string) Write a constructor to initialize the above Employee attributes. Create an abstract method called earnings.      Create another class HourlyEmployee that inherits from the abstract Employee class.   HourEmployee must use the inherited parent class variables and add in attributes HourlyRate and HoursWorked. Your HourEmployee class should...

  • Java Description Write a program to compute bonuses earned this year by employees in an organization....

    Java Description Write a program to compute bonuses earned this year by employees in an organization. There are three types of employees: workers, managers and executives. Each type of employee is represented by a class. The classes are named Worker, Manager and Executive and are described below in the implementation section. You are to compute and display bonuses for all the employees in the organization using a single polymorphic loop. This will be done by creating an abstract class Employee...

  • Create the Python code for a program adhering to the following specifications. Write an Employee class...

    Create the Python code for a program adhering to the following specifications. Write an Employee class that keeps data attributes for the following pieces of information: - Employee Name (a string) - Employee Number (a string) Make sure to create all the accessor, mutator, and __str__ methods for the object. Next, write a class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class should keep data attributes for the following information: - Shift number (an integer,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT