an I please have the flow chart for this Python Code. current_year = 2021 class Employee: # constructor def __init__(self) -> None: self.employee_no = 0 self.name = "" self.status = "" self.position = "" self.basic_salary = 0 self.year_end_bonus = 0 self.year_hired = 0 # function to get employee date from user def get_data(self): self.employee_no = int(input("Enter employee number: ")) self.name = input("Enter employee name: ") self.status = input("Enter employee status(T/P/C): ") self.position = input("Enter employee position title: ") self.year_hired = int(input("Enter year hired: ")) # function to calculate gross salary based on employee information # and criteria as given in question def calculate_gross_salary(self): rate_per_hour = 0.0 years_of_service = current_year - self.year_hired # rate per hour case 1 if self.status == "C" and years_of_service == 1: rate_per_hour = float(input("Please enter the rate per hour(500-950): ")) while rate_per_hour not in range(500, 951): print("Invalid rate per hour") rate_per_hour = float(input("Please enter the rate per hour(500-950): ")) # rate per hour case 2 elif self.status == "P" and years_of_service in range(2, 4): rate_per_hour = float(input("Please enter the rate per hour(1000-1500): ")) while rate_per_hour not in range(1000, 1501): print("Invalid rate per hour") rate_per_hour = float(input("Please enter the rate per hour(1000-1500): ")) # rate per hour case 3 elif self.status == "T" and years_of_service in range(4, 11): rate_per_hour = float(input("Please enter the rate per hour(1950-2500): ")) while rate_per_hour not in range(1950, 2500): print("Invalid rate per hour") rate_per_hour = float(input("Please enter the rate per hour(1950-2500): ")) # rate per hour case 4 elif self.status == "T" and years_of_service > 10: rate_per_hour = float(input("Please enter the rate per hour(3000-5000): ")) while rate_per_hour not in range(3000, 5000): print("Invalid rate per hour") rate_per_hour = float(input("Please enter the rate per hour(3000-5000): ")) # calculate the basic salary self.basic_salary = rate_per_hour * 160 # function to calculate the annual salary def calculate_annual_salary(self): self.calculate_gross_salary() return self.basic_salary * 12 # function to calculate the year end bonus # according to criteria as given in question def calculate_year_end_bonus(self): bonus = 0.0 years_of_service = current_year - self.year_hired # case 1 if self.status == "C" and years_of_service == 1: bonus = .1 # case 2 elif self.status == "P" and years_of_service in range(2, 4): bonus = .2 # case 3 elif self.status == "T" and years_of_service in range(4, 11): bonus = .5 # case 4 elif self.status == "T" and years_of_service > 10: bonus = .75 # calculate year end bonus self.year_end_bonus = self.calculate_annual_salary() * bonus # function to display employee data def display(self): self.calculate_year_end_bonus() print("Employee number:", self.employee_no) print("Employee name:", self.name) print("Employee status:", self.status) print("Employee position:", self.position) print("Employee year hired:", self.year_hired) print("Employee basic salary:", self.basic_salary) print("Employee year end bonus:", self.year_end_bonus) # create employee object emp = Employee() # get data from user emp.get_data() # show the employee data emp.display()

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Can I please have the flow chart for this Python Code.

 

current_year = 2021

class Employee:
    # constructor
    def __init__(self) -> None:
        self.employee_no = 0
        self.name = ""
        self.status = ""
        self.position = ""
        self.basic_salary = 0
        self.year_end_bonus = 0
        self.year_hired = 0

    # function to get employee date from user
    def get_data(self):
        self.employee_no = int(input("Enter employee number: "))
        self.name = input("Enter employee name: ")
        self.status = input("Enter employee status(T/P/C): ")
        self.position = input("Enter employee position title: ")
        self.year_hired = int(input("Enter year hired: "))

    # function to calculate gross salary based on employee information
    # and criteria as given in question
    def calculate_gross_salary(self):
        rate_per_hour = 0.0
        years_of_service = current_year - self.year_hired

        # rate per hour case 1
        if self.status == "C" and years_of_service == 1:
            rate_per_hour = float(input("Please enter the rate per hour(500-950): "))

            while rate_per_hour not in range(500, 951):
                print("Invalid rate per hour")
                rate_per_hour = float(input("Please enter the rate per hour(500-950): "))
        # rate per hour case 2
        elif self.status == "P" and years_of_service in range(2, 4):
            rate_per_hour = float(input("Please enter the rate per hour(1000-1500): "))

            while rate_per_hour not in range(1000, 1501):
                print("Invalid rate per hour")
                rate_per_hour = float(input("Please enter the rate per hour(1000-1500): "))
        # rate per hour case 3
        elif self.status == "T" and years_of_service in range(4, 11):
            rate_per_hour = float(input("Please enter the rate per hour(1950-2500): "))

            while rate_per_hour not in range(1950, 2500):
                print("Invalid rate per hour")
                rate_per_hour = float(input("Please enter the rate per hour(1950-2500): "))
        # rate per hour case 4
        elif self.status == "T" and years_of_service > 10:
            rate_per_hour = float(input("Please enter the rate per hour(3000-5000): "))

            while rate_per_hour not in range(3000, 5000):
                print("Invalid rate per hour")
                rate_per_hour = float(input("Please enter the rate per hour(3000-5000): "))

        # calculate the basic salary
        self.basic_salary = rate_per_hour * 160
    
    # function to calculate the annual salary
    def calculate_annual_salary(self):
        self.calculate_gross_salary()
        return self.basic_salary * 12

    # function to calculate the year end bonus
    # according to criteria as given in question
    def calculate_year_end_bonus(self):
        bonus = 0.0
        years_of_service = current_year - self.year_hired

        # case 1
        if self.status == "C" and years_of_service == 1:
            bonus = .1
        # case 2
        elif self.status == "P" and years_of_service in range(2, 4):
            bonus = .2
        # case 3
        elif self.status == "T" and years_of_service in range(4, 11):
            bonus = .5
        # case 4
        elif self.status == "T" and years_of_service > 10:
            bonus = .75

        # calculate year end bonus
        self.year_end_bonus = self.calculate_annual_salary() * bonus

    # function to display employee data
    def display(self):
        self.calculate_year_end_bonus()
        print("Employee number:", self.employee_no)
        print("Employee name:", self.name)
        print("Employee status:", self.status)
        print("Employee position:", self.position)
        print("Employee year hired:", self.year_hired)
        print("Employee basic salary:", self.basic_salary)
        print("Employee year end bonus:", self.year_end_bonus)


# create employee object
emp = Employee()
# get data from user
emp.get_data()
# show the employee data 
emp.display()

 

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education