Skip to content

Instantly share code, notes, and snippets.

View jmoon90's full-sized avatar

John Moon jmoon90

  • New York, NY
View GitHub Profile
@jmoon90
jmoon90 / run_ts.rb
Last active December 29, 2015 14:48
require_relative "test_reader"
require_relative "test_scores.rb"
read_class= TestReader.new
read_class.parse_data
read_class.student_grade
read_class.test_score
require 'pry'
class HomePurchaseOption
attr_accessor :equity_after_sale
def initialize(property)
@i = 0
@property = property
@mortgage_balance = {}
equity_after_sale
required_mortgage
end
@jmoon90
jmoon90 / game.rb
Last active December 30, 2015 00:29
Rumble
require 'pry'
class Game
attr_reader :winner, :game_info
def initialize(team_score)
@team_score = team_score
game_info
end
require_relative 'tax_calculation'
record_list =
[
{
first_name: 'Johnny',
last_name: 'Smith',
annual_income: 120000,
tax_paid: 28000
},
#!/user/bin/env ruby
require "csv"
class Tracker
attr_reader :balance
def initialize
@balance = 0
@income = 0
@expenses = 0
@overdraft = 0
class Car
@@makes_models = []
def self.add_make(make, *model)
models = []
make_model = {}
models << model
make_model[make] = models
@@makes_models << make_model
end
class Animal
attr_reader :name
def initialize
end
def sound
"ajclvkja"
end
def emote
class PigLatinTranslation
def initialize(phrase)
@phrase = phrase
@translated_phrase = []
words
puts @translated_phrase.join(' ').capitalize
end
#provide the pig latin translation
def translate(word)
class Circle
def initialize(radius)
@radius = radius
end
def perimeter
(Math::PI * @radius * 2).round(3)
end
def area
require 'rspec'
require_relative 'pig_latin_translator'
describe PigLatinTranslator do
it 'converts words in a phrase to pig latin' do
expect(PigLatinTranslator.new('happy').translate).to eql('appyhay')
end
it 'converts words in a phrase to pig latin' do
expect(PigLatinTranslator.new('glove').translate).to eql('oveglay')