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.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 1CP: In previous chapters, you have created programs for the Greenville Idol competition. Now create a...
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
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage