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.
1
Expert's answer
2011-05-23T10:33:38-0400
# 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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS