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...

  • In C++ please! Thanks! Define a class Employee with data members as int employee_id – To...

    In C++ please! Thanks! Define a class Employee with data members as int employee_id – To store employee ID. String employee_name – To store the name of the employee. Define class Salary which inherits Employee class and has the following characteristics Data members String designation – To store employee designation. double monthly_salary – To store salary of the employee. Methods constructor Salary(int employee_id, String employee_name, String designation, double monthly_salary) – Invokes a superclass constructor and initialize data members. void display()...

  • Write a class named Employee that holds the following data about an employee in attributes: name,...

    Write a class named Employee that holds the following data about an employee in attributes: name, ID number, department, and job title. Don't include a constructor or any other methods. Written in Python and formatted like it says below!!!!! Once you have written the class, write a program that creates three Employee objects to hold the following data: Name ID Number Department Job Title Susan Meyers 47899 Accounting Vice President Mark Jones 39119 IT Programmer Joy Rogers 81774 Manufacturing Engineering...

  • 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....

  • This question is designed to test your understanding and application of inheritance,composition, polymorphism, exceptions and file...

    This question is designed to test your understanding and application of inheritance,composition, polymorphism, exceptions and file handling. You are required to write classes representing a taxi fleet made up of cars and vans. Section A You are to write three classes named Fleet, Car and Van, to represent the fleet of a taxi company. An Fleet object is composed of upto 5 Car objects and 2 Van objects. In addition to the methods specified below you are free to place...

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