Create a complete BankAccount class with the following specifications.
Constructor (__init__):
owner (str), balance (float, default 0)transaction_history list, initially emptyMethods:
deposit(amount): Add amount to balance, record in history, return new balancewithdraw(amount): Subtract amount if sufficient funds, record in history, return new balance or -1 if insufficientget_balance(): Return current balanceget_history(): Return list of transaction stringsSpecial Methods:
__str__: Return "Account: {owner}, Balance: ${balance}"Each transaction should be recorded as:
"Deposit: +${amount}""Withdrawal: -${amount}"Start by storing owner, balance, and an empty list for history. For withdraw, check if amount > self.balance first and return -1 if true. For __str__, use an f-string with the required format.
Create a shape class hierarchy with a base Shape class and two child classes: Rectangle and Circle.
__init__(self, name): Store the shape namearea(self): Return 0 (to be overridden)perimeter(self): Return 0 (to be overridden)describe(self): Return "{name}: Area={area}, Perimeter={perimeter}"__init__(self, width, height): Call parent with "Rectangle", store width/heightarea(self): Return width × heightperimeter(self): Return 2 × (width + height)__init__(self, radius): Call parent with "Circle", store radiusarea(self): Return π × radius² (use 3.14159)perimeter(self): Return 2 × π × radiusUse super().__init__("Rectangle") in child classes. The describe method in Shape should call self.area() and self.perimeter() - polymorphism will use the child's versions!
Create an employee management system with different employee types and a company class to manage them.
__init__(self, name, base_salary)calculate_pay(self): Return base_salary__str__(self): Return "{name} - ${pay}"__init__(self, name, base_salary, bonus)calculate_pay(self): Return base_salary + bonus__init__(self, name, base_salary, projects): projects is intcalculate_pay(self): Return base_salary + (projects × 500)__init__(self, name): Store name, create empty employees listadd_employee(self, employee): Add to listtotal_payroll(self): Sum of all employee payget_employees(self): Return list of employee namesUse super().__init__(name, base_salary) in Manager and Developer. For Company, use sum(emp.calculate_pay() for emp in self.employees) for total_payroll. Use a list comprehension for get_employees.