Question

Employees in a bank have their name, id, age, telephone and total salary. You are required...

Employees in a bank have their name, id, age, telephone and total salary. You are required to write a Python class to represent the employees. Write the constructor, and other required methods to complete your code. The bank has decided to pay a 10% salary increase to employees above the age of 45. Your class should have an extra method to increase salary depending on the age of the employee. Test the class by creating two objects of the class, one employee with age less than 45 and the other above 45 and display both their salaries.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is the python code for the given specification:

NOTE:

THE statements starting with "#" are comments and dont affect the execuetion of the program.

OUTPUT :

amrit@amrit-Inspiron-15-3567 -/Projects/Semester $ python3 employee.py Name of the employee : Amrit Employee id : 1243 Age : 25 Telephone : 9861557789 Total salary : 100000 Name of the employee : Ankit Employee id : 143 Age : 47 Telephone : 97645648798 Total salary : 110000.0

Add a comment
Know the answer?
Add Answer to:
Employees in a bank have their name, id, age, telephone and total salary. You are required...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • python code? 1. Create a class called Person that has 4 attributes, the name, the age,...

    python code? 1. Create a class called Person that has 4 attributes, the name, the age, the weight and the height [5 points] 2. Write 3 methods for this class with the following specifications. a. A constructor for the class which initializes the attributes [2.5 points] b. Displays information about the Person (attributes) [2.5 points] c. Takes a parameter Xage and returns true if the age of the person is older than Xage, false otherwise [5 points] 3. Create another...

  • C++ Program 2 Consider a class Employee with data members: age (an integer), id (an integer)...

    C++ Program 2 Consider a class Employee with data members: age (an integer), id (an integer) and salary (a float), and their corresponding member functions as follows: class Employee { private: int age; int id; float salary: public: Employee; // default constructor: age=0, id=0, and salary=0 void setAge(int x); // let age = x void setId(int x); // let id = x void setSalary(float x); // salary = x int getAge(); // return age int getId; // return id float...

  • c++ please need help with this question Consider a class Employee with data members: age(an integer),...

    c++ please need help with this question Consider a class Employee with data members: age(an integer), id (an integer) and salary (a float), and their corresponding member functions as follows: class Employee {        private:             int age;             int id;             float salary;        public:             Employee( ); // default constructor: age=0, id=0, and salary=0             Employee(Employee &x);   // copy constructor           Employee& operator = (Employee &x); // equal sign operator             void setAge(int x);    // let age = x...

  • c++ only Design a class representing an Employee. The employee would have at least these private...

    c++ only Design a class representing an Employee. The employee would have at least these private fields (Variables): name: string (char array) ID: string (char array) salary: float Type: string (char array) All the variables except for the salary should have their respective setters and getters, and the class should have two constructors, one is the default constructor and the other constructor initializes the name,ID and type of employee with valid user input. The class should have the following additional...

  • In header file (.h) and c++ file format (.cpp). A local company has asked you to...

    In header file (.h) and c++ file format (.cpp). A local company has asked you to write a program which creates an Employee class, a vector of Employee class objects, and fills the objects with employee data, creating a "database" of employee information. The program allows the user to repeatedly search for an employee in the vector by entering the employee's ID number and if found, display the employee's data. The Employee_C class should have the following data and in...

  • paython code :- UML A hospital is a very busy place with a lot of patients...

    paython code :- UML A hospital is a very busy place with a lot of patients and also a lot of employees to keep the system running perfectly. All people in the hospital have basic information like title, name, gender, address, and phone number. Employees of the hospital have extra information like employee-id and salary. For every 25 employees, there is a manager who is also an employee, but gets an allowance of 7% more than the salary. There are...

  • Write a Python class, Circle, constructed by a radius and two methods which will compute the...

    Write a Python class, Circle, constructed by a radius and two methods which will compute the area and the perimeter of a circle. Include the constructor and other required methods to set and get class attributes. Create instances of Circle and test all the associated methods. Write a Python class, Rectangle, constructed by length and width and a method which will compute the area of a rectangle. Include the constructor and other required methods to set and get class attributes....

  • When answering this question, can you please specify what you name your files? Thank you! Write a...

    When answering this question, can you please specify what you name your files? Thank you! Write a Java application, and an additional class to represent some real-world entity. Keep in mind that a class is a model in code of something real or imagined, which has attributes (member variables) and behaviors (member methods). The class will: a. Create a total of 5 member variables for the class, selecting the appropriate data types for each field. For example, a class to...

  • Using C++, Write a class named Employee that has the following member variables: name. A string...

    Using C++, Write a class named Employee that has the following member variables: name. A string that holds the employee's name. idNumber. An int variable that holds the employee's ID number. department. A string that holds the name of the department where the employee works. position. A string that holds the employee's job title. The class should have the following constructors: A constructor that accepts the following values as arguments and assigns them to the appropriate member variables: employee's name,...

  • Java Description Write a program to compute bonuses earned this year by employees in an organization....

    Java Description Write a program to compute bonuses earned this year by employees in an organization. There are three types of employees: workers, managers and executives. Each type of employee is represented by a class. The classes are named Worker, Manager and Executive and are described below in the implementation section. You are to compute and display bonuses for all the employees in the organization using a single polymorphic loop. This will be done by creating an abstract class Employee...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT