'''lecture_23_colbystudent.py
Design class ColbyStudent
Oliver W. Layton
CS 151: Computational Thinking: Visual Media
Fall 2020

TODO:
1. Add last day of class global variable (Dec 4)
    - Access with vs. without get method
    - Change date to Nov 24 and demonstrate change across all ColbyStudent objects
    - Show symbol table
2. Shallow copy access for getGrades in main code
    - Show symbol table
    - Fix issue in getGrades
'''


class ColbyStudent():
    def __init__(self, name, year=2022):
        # Initialization data
        self.name = name
        self.year = year

        # Derived data
        self.grades = []
        self.gpa = 0.0

    def getName(self):
        return self.name

    def addGrade(self, newGrade):
        self.grades.append(newGrade)


'''
Update 1: class global variable
'''
mike = ColbyStudent('Mike', year=2022)
lilly = ColbyStudent('Lilly', year=2022)
# print('Mike last day:', )
# print('Lilly last day:', )

# print("Class access last day:", )

# ColbyStudent.lastDayofClass = 'Nov 24'
# print('Mike last day:', )
# print('Lilly last day:', )

'''
Update 2: Copy issues
'''
# Make a student, add grades to show memory access problems
# mike = ColbyStudent('Mike', year=2022)
# mike.addGrade(4)
# mike.addGrade(3)
# mike.addGrade(1)

# mikesGrades = mike.getGrades()
# print('Mike\'s grades outside the object', mikesGrades)

# # Modify grades then print grades and the grades from the student accessed again
# mikesGrades.pop()
# print('Mike\'s grades outside the object (after pop)', mikesGrades)
# print('Mike\'s grades object instance variable', mike.getGrades())
