Answer to Question #2540 in Python for sagar

Question #2540
Write a class CustomerAccount that stores the account number, name, address, interest rate and balance. Include the Constructor, Accessor, and Mutator methods.
Expert's answer
# The implementation of the class CustomerAccount
class CustomerAccount:

# The Constructor
def __init__(self, number, name, address, rate, balance):
& self.__number = number
& self.__name = name
& self.__address = address
& self.__rate = rate
& self.__balance = balance

# The Accessor methods
def GetNumber(self):
& return self.__number

def GetName(self):
& return self.__name

def GetAddress(self):
& return self.__address

def GetRate(self):
& return self.__rate

def GetBalance(self):
& return self.__balance

# The Mutator methods
def SetNumber(self, number):
& self.__number = number

def SetName(self, name):
& self.__name = name

def SetAddress(self, address):
& self.__address = address

def SetRate(self, rate):
& self.__rate

def SetBalance(self, balance):
& self.__balance

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

New on Blog