0

I have this code:

class Member:

    def __init__(self, name, typeOM, fee, yearJoin):

        self.name = name
        self.typeOM = typeOM
        self.fee = float(fee)
        self.yearJoin = yearJoin
   
    # Reader Methods
    def getName(self):
        return self.name

    def getTypeOM(self):
        return self.typeOM

    def getFee(self):
        return self.fee

    def getYearJoin(self):
        return self.yearJoin

    def getMemberTypeString(self):
        if self.typeOM == 'P' or self.typeOM == 'p':
            return "Playing"
        else:
            return "Social"

    
    # Writter Methods

    def setName(self, nameIn):
        self.name = nameIn

    def setTypeOM(self, typeOMIn):
        self.typeOM = typeOMIn

    def setYearJoin(self, yearJoinIn):
        self.yearJoin = yearJoinIn

    
    # toString method

    def __str__(self):
        return "%s (%s  member) joined in %i" \
               %(self.name, str(self.getMemberTypeString), self.yearJoin)

The getMemberTypeString method is supposed to determine from the typeOM the type of member then print the appropriate string, but i keep getting a memory address reference(at least thats what i think it is), what am i doing wrong??

Here's what i get:

Mark (<bound method Member.getMemberTypeString of <__main__.Member instance at 0xb662044c>>  member) joined in 1989
2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by soUPERMan
0

In line 46, you're not actually calling the method. Try self.getMemberTypeString() in line 46 instead of self.getMemberTypeString.

0

Thanks, that solved it...how come the other methods like self.name work without the empty brackets?? Thanks again for the help

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.