Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

please follow the intstructions really need help

In this assignment you are asked to write a Python program to define a class to model the characteristics of a
generic employee. The class is part of a slightly larger hypothetical program that includes code to use the class
to create some employee objects and test its methods. The name of the class is 'Employee' and includes the
following methods and attributes:
Method Name
Purpose
Input
Output/returns
init
Constructor - sets initial values for all object See below@
None
attributes.
Displays a readable version of the Employee None
object
Employee data as a
printable string
str
Calculates and returns the employee's
hourly rate of pay – divides salary by 2080
hourly_rate
None
Hourly rate (float)
Returns the employee's current age in years Today's
- subtracts today's year from birth year, but month (int)
accounts for month differences (i.e. if birth
month occurs before today's month, age is
age
age (int)
and today's
year(int)
current year minus birth year, otherwise
that minus 1)
retire
If age > 70, returns 'True' – employee is
eligible to retire. Otherwise, 'False'
Today's
month (int)
and today's
year(int)
True or False
Attribute@
Туре
Definition
employee_id
str
ID: “E" + 5 digits
str
Employee name – “<last name>, <first name>"
name
birth_month
int
Integer in range 1 to 12
birth_year
int
Integer, 4 digits, range 1800 and above
job_des
str
Description or title of the employee's job
annual_salary
int
Annual salary: integer in range 0 to 1000000
In addition to the class definition, include the following global code that creates employee objects, prints those
objects, prints additional information on them using dot-notation access to attributes, and executes methods
expand button
Transcribed Image Text:In this assignment you are asked to write a Python program to define a class to model the characteristics of a generic employee. The class is part of a slightly larger hypothetical program that includes code to use the class to create some employee objects and test its methods. The name of the class is 'Employee' and includes the following methods and attributes: Method Name Purpose Input Output/returns init Constructor - sets initial values for all object See below@ None attributes. Displays a readable version of the Employee None object Employee data as a printable string str Calculates and returns the employee's hourly rate of pay – divides salary by 2080 hourly_rate None Hourly rate (float) Returns the employee's current age in years Today's - subtracts today's year from birth year, but month (int) accounts for month differences (i.e. if birth month occurs before today's month, age is age age (int) and today's year(int) current year minus birth year, otherwise that minus 1) retire If age > 70, returns 'True' – employee is eligible to retire. Otherwise, 'False' Today's month (int) and today's year(int) True or False Attribute@ Туре Definition employee_id str ID: “E" + 5 digits str Employee name – “<last name>, <first name>" name birth_month int Integer in range 1 to 12 birth_year int Integer, 4 digits, range 1800 and above job_des str Description or title of the employee's job annual_salary int Annual salary: integer in range 0 to 1000000 In addition to the class definition, include the following global code that creates employee objects, prints those objects, prints additional information on them using dot-notation access to attributes, and executes methods
to calculate other information about employees:
print('\nStart of Employee class demo')
el = Employee('E34568', 'David Miller', 1960, 3, 'Accountant', 65000)
e2 = Employee('E22154', 'Margarete Smith', 1972, 10, 'Vice President', 115000)
e3 = Employee('E43344', 'Chase Smedley', 1982, 8, 'Salesman', 75000)
e4 = Employee('E12157', 'Daniel Arledge', 1959, 11, 'Lawyer', 92000)
e5 = Employee('E00001', 'Abe Lincoln', 1940, 2, 'Former POTUS', 10000)
print('el =', el)
print('e2 = ', e2)
print('e3 = ', e3)
print('e4 = ', e4)
print('e5 = ', e5)
print('Hourly rate for ', el.name, ' is ', el1.hourly_rate())
print('Age of ', e3.name, ' is ', e3.age(9, 2019))
print('Job description of ',e4.name,'is ',e4.job_des)
print('Retirement eligibility for ', e2.name, ' is ', e2.retire(9, 2019))
print('Retirement eligibility for ', e5.name, ' is', e5.retire(9, 2019))
print('\nEnd of Employee class demo')
expand button
Transcribed Image Text:to calculate other information about employees: print('\nStart of Employee class demo') el = Employee('E34568', 'David Miller', 1960, 3, 'Accountant', 65000) e2 = Employee('E22154', 'Margarete Smith', 1972, 10, 'Vice President', 115000) e3 = Employee('E43344', 'Chase Smedley', 1982, 8, 'Salesman', 75000) e4 = Employee('E12157', 'Daniel Arledge', 1959, 11, 'Lawyer', 92000) e5 = Employee('E00001', 'Abe Lincoln', 1940, 2, 'Former POTUS', 10000) print('el =', el) print('e2 = ', e2) print('e3 = ', e3) print('e4 = ', e4) print('e5 = ', e5) print('Hourly rate for ', el.name, ' is ', el1.hourly_rate()) print('Age of ', e3.name, ' is ', e3.age(9, 2019)) print('Job description of ',e4.name,'is ',e4.job_des) print('Retirement eligibility for ', e2.name, ' is ', e2.retire(9, 2019)) print('Retirement eligibility for ', e5.name, ' is', e5.retire(9, 2019)) print('\nEnd of Employee class demo')
Expert Solution
Check Mark
Still need help?
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

_name_ is not defined

Solution
Bartleby Expert
by Bartleby Expert
SEE SOLUTION
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

_name_ is not defined

Solution
Bartleby Expert
by Bartleby Expert
SEE SOLUTION
Knowledge Booster
Background pattern image
Computer Science
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
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education