Need help using python. Create a Employee class with four instance attributes: emp_number as an int, name as a string, department as a string and yearly_salary as an int. The class should include  an __init__() method to initialize an Employee object and a __str__() method to describe an initialized Employee object. The class should include two instance methods: one called update_department(), which takes a string as an argument and updates the employee's department attribute; and one called update_salary(), which takes an int as an argument and updates the employee's salary attribute. After the Employee class code, prompt the user to enter the emp_number, name, department and salary. Instantiate an Employee object by passing in the user's input as the arguments and print out the Employee's attributes by calling the __str__() method. No prompting for input should be included in the Employee class. Test the update_department() and update_salary() methods by calling both methods and passing in a new department and salary for the Employee object that you created. Call the __str__() to display the updated Employee's information.

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

Need help using python. Create a Employee class with four instance attributes: emp_number as an int, name as a string, department as a string and yearly_salary as an int. The class should include  an __init__() method to initialize an Employee object and a __str__() method to describe an initialized Employee object. The class should include two instance methods: one called update_department(), which takes a string as an argument and updates the employee's department attribute; and one called update_salary(), which takes an int as an argument and updates the employee's salary attribute.

After the Employee class code, prompt the user to enter the emp_number, name, department and salary. Instantiate an Employee object by passing in the user's input as the arguments and print out the Employee's attributes by calling the __str__() method. No prompting for input should be included in the Employee class.

Test the update_department() and update_salary() methods by calling both methods and passing in a new department and salary for the Employee object that you created. Call the __str__() to display the updated Employee's information.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 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