Question

Write a program that would calculate the employees salaries Calculate: Weekly/Monthly/Annually Kate Austin: 12$/hr Id ID:...

Write a program that would calculate the employees salaries Calculate: Weekly/Monthly/Annually Kate Austin: 12$/hr Id ID: 15667 Human Resources, Joe Krenz: 17/hr Id: 15666 Sales, Jane Washburn 15$/hr Id:15679 Marketing, Lisa Booker 11.50/hr Id: 15684 sales, Rich Blake 19.25$/hr ID: 15671 Sales

python and to read from keyboard

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

*Please follow the comments to better understand the code.

**Please look at the Screenshot below and use this code to copy-paste.

***The code in the below screenshot is neatly indented for better understanding.



class Employee:
    # Data needed
    # We assume that the employee works for 8 hours daily
    hours_worked_per_day = 8
    num_of_working_days_in_week = 5
    num_of_weeks_in_month = 4
    num_of_months_in_year = 12

    # Constructor
    def __init__(self, name, hourly_wage, id, department):
        self.department = department
        self.id = id
        self.hourly_wage = hourly_wage
        self.name = name

    # get the weekly salaries
    def get_weekly_salary(self):
        return self.num_of_working_days_in_week * self.hours_worked_per_day * self.hourly_wage

    # get the monthly salaries
    def get_monthly_salary(self):
        return self.num_of_weeks_in_month * self.get_weekly_salary()

    # get the annual salaries
    def get_annually_salary(self):
        return self.num_of_months_in_year * self.get_monthly_salary()


# TEST
employee1 = Employee("Kate Austin", 12.0, 15667, "Human Resources")
print(employee1.name, '\t\tWeekly Salary:$', employee1.get_weekly_salary(), end='\t\t')
print('Monthly Salary:$', employee1.get_monthly_salary(), end='\t\t')
print('Annually Salary:$', employee1.get_annually_salary())

employee2 = Employee("Joe Krenz   ", 17.0, 15666, "Sales")
print(employee2.name, '\t\tWeekly Salary:$', employee2.get_weekly_salary(), end='\t\t')
print('Monthly Salary:$', employee2.get_monthly_salary(), end='\t\t')
print('Annually Salary:$', employee2.get_annually_salary())

employee3 = Employee("Jane Washburn", 15.0, 15679, "Marketing")
print(employee3.name, '\t\tWeekly Salary:$', employee3.get_weekly_salary(), end='\t\t')
print('Monthly Salary:$', employee3.get_monthly_salary(), end='\t\t')
print('Annually Salary:$', employee3.get_annually_salary())

employee4 = Employee("Lisa Booker", 11.50, 15684, "Sales")
print(employee4.name, '\t\tWeekly Salary:$', employee4.get_weekly_salary(), end='\t\t')
print('Monthly Salary:$', employee4.get_monthly_salary(), end='\t\t')
print('Annually Salary:$', employee4.get_annually_salary())

employee5 = Employee("Rich Blake  ", 19.25, 15671, "Sales")
print(employee5.name, '\t\tWeekly Salary:$', employee5.get_weekly_salary(), end='\t\t')
print('Monthly Salary:$', employee5.get_monthly_salary(), end='\t\t')
print('Annually Salary:$', employee5.get_annually_salary())

==========

TEST

Add a comment
Know the answer?
Add Answer to:
Write a program that would calculate the employees salaries Calculate: Weekly/Monthly/Annually Kate Austin: 12$/hr Id ID:...
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
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
Active Questions
ADVERTISEMENT