Python Language Write your first class! Look at the Employee class above, copy and paste to employee.py in your IDE afte

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Python Language Write your first class! Look at the Employee class above, copy and paste to employee.py in your IDE afte

Post by answerhappygod »

Python Language
Write your first class! Look at the Employee class above, copyand paste to employee.py in your IDEafter you createyour Module10 project, class_definitionspackage and test package.
In designing code, we often use UML diagrams, below is the UMLdiagram for Employee class. In Python, it is less obvious the typeof data members. The - minus sign means private and the + plus signmeans public. Use the convention to consider private in naming yourclass variables in your constructor, do not use name mangling. Notethe examples above did not consider class data members private!
last_name: stringfirst_name: stringaddress: stringphone_number: stringsalaried: booleanstart_date: datetimesalary: doubleMethods:display() returns a string that when printedwill follow the below format:
Start date: 6-28-2019
Note this will have some logic statements to check for salariedor hourly to construct the return string
Below is the employee class to work with:
Here is person class that you may also need:
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply