1. Develop a class BankAccount that supports these methods
__init__(): Initializes the bank account balance to the value of the input argument, or to 0 if no input argument is given
withdraw(): Takes an amount as input and withdraws it from the balance
deposit(): Takes an amount as input and adds it to the balance
balance(): Returns the balance on the account
>>> x = BankAccount(700)
>>> x.balance()
700.00
>>> x.withdraw(70)
630.00
2. In the above problem, there are some problems with the implementation of the class BankAccount, and they are illustrated here:
>>> x = BankAccount(-700)
>>> x.balance()
-700
>>> x.withdraw(70)
>>> x.balance()
-770
>>> x.deposit(-7)
>>> x.balance()
-777
Define new exception classes NegativeBalanceError, OverdraftError, and DepositError that would be raised for the above situations. In addition, the informal string representation of the exception object should contain the balance that would result from the negative balance account creation, the overdraft, or the negative deposit. (Problem 8.44)
3. Write a GUI class BMI that allows you to compute your Body Mass Index (BMI). The user should type a height in inches and a weight in pounds into the window. After entering a weight and a height and then clicking the button, the computed BMI should appear in a new window. At the same time that the window with the BMI is displayed, the main window should be emptied so that each of the entries is ready for the next set of numbers:
The formula for computing the BMI is weight * 703/ height **2.
4. Implement class Worker that supports methods (Problem 8.25):
__init__(): Constructor that takes as input the worker's name (as a string) and the hourly pay rate (as a number)
changeRate(): Takes the new pay rate as input and changes the worker's pay rate to the new hourly rate
pay(): Takes the number of hours worked as input and prints 'Not implemented'.
Next develop classes HourlyWorker and SalariedWorker as subclasses of Worker. Each overloads the inherited method pay() to compute the weekly pay for the worker. Hourly workers are paid the hourly rate for the actual hours worked; any overtime hours above 40 are paid double. Salaried workers are paid for 40 hours regardless of the number of hours worked. Because the number of hours is not relevant, the method pay() for salaried workers should also be callable without an input argument.