Skip to content

Instantly share code, notes, and snippets.

View justuseapen's full-sized avatar

Justus Eapen justuseapen

View GitHub Profile
require 'pry'
class Car
class Make < Car
@@makes = []
def self.add_make(make)
@@makes << make
class Animal
def emote
puts "#{name} #{sound}ed annoyingly"
end
def eat
puts "#{name} ate #{sustenance}."
end
end
class Duck < Animal
name grade
John Smith 75
Sally Field 85
Jane Doe 93
Gus Grumpy 98
Mark Marcus 68
Vic Victor 83
Frank Furter 89
John Bello 78
Liz Branch 99
@justuseapen
justuseapen / assignment_grade.rb
Created December 2, 2013 18:48
Object Oriented Programming Challenge
class AssignmentGrade
def initialize (score)
@score = score.to_i
end
def score
@score
end
def all
class Circle
def initialize(radius)
@radius = radius
end
def diameter
@diameter = @radius * 2
end
def circumference
Math::PI*@diameter
end
# Implement your solution here. You may reference any additional files from here as well.
@results = []
def team_names_and_scores
puts "What was team one's name?"
team1 = gets.chomp
puts "What was team one's score?"
team1_score = gets.chomp
# Implement your solution here. You may reference any additional files from here as well.
@results = []
def team_names_and_scores
puts "What was team one's name?"
team1 = gets.chomp
puts "What was team one's score?"
team1_score = gets.chomp
class Whiteboard
attr_accessor :contents
def initialize(contents = [])
@contents = contents
end
def wipe_board
@contents = []
end
class Whiteboard
attr_accessor :contents
def initialize(contents = [])
@contents = contents
end
def wipe_board
@contents = []
end
class Card
def initialize(rank, suit)
@suit = suit
@rank = rank
end
def rank
@rank
end