Created
February 14, 2015 19:06
-
-
Save anonymous/6bb34533ff9dae715823 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Grade | |
attr_accessor :assignment_name | |
attr_accessor :max_points | |
attr_accessor :points_received | |
#define initializer | |
def initialize(name, points, score = nil) | |
@assignment_name = name | |
@max_points = points | |
@points_received = score | |
end | |
#define method to format input | |
def to_s | |
points_received = @points_received || '--' | |
'%-15.15s' % @assignment_name + " : " + '%-2.2s' % @max_points + " " + '%-2.2s' % points_received | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment