Question 1) The code given defines the start of the class to represent bank accounts:
class BankAccount(object):
interest_rate = 0.3
def __init__(self, name, number, balance):
self.name = name
self.number = number
self.balance = balance
return
a) Write down the name of the class variables and instance variables in the given code.
b) Add instance methods called deposit() and withdraw() that increase and decrease balance of the account. Ensure that withdraw() method does not permit the account to go into overdraft. Add a third method called add_interest() that adds interest to balance (the interest must be the interest rate multiplied by the present balance).
c) Create subclass of BankAccount known as StudentAccount. Every StudentAccount must have the overdraft limit of 1000. Write down a constructor for the new class. Override the withdraw() method to ensure that students can withdraw money up to their overdraft limits.
Question 2)A palindromic word is one which reads same backwards as forwards. Therefore the words peep and deed are palindromes.
a) Create down a class called Palindrome.
b) In your Palindrome class, produce a method called reverse() that takes a string argument. Your method must return reverse of the argument as a string. For instance, if argument is Foobar then your method must return rabooF.
c) Make a second method in Palindrome called isPalindrome() that takes a string argument. This method must return True if argument is a palindrome and False otherwise.
d) Write some code to test your new Palindrome class and print out results of your testing to the user. Provide some consideration to what sort of strings you might want to use for your testing.