This file contains hidden or 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
| 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 | |
This file contains hidden or 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
| require 'pry' | |
| class HomePurchaseOption | |
| attr_accessor :equity_after_sale | |
| def initialize(property) | |
| @i = 0 | |
| @property = property | |
| @mortgage_balance = {} | |
| equity_after_sale | |
| required_mortgage | |
| end |
This file contains hidden or 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
| require 'pry' | |
| class Game | |
| attr_reader :winner, :game_info | |
| def initialize(team_score) | |
| @team_score = team_score | |
| game_info | |
| end |
This file contains hidden or 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
| require_relative 'tax_calculation' | |
| record_list = | |
| [ | |
| { | |
| first_name: 'Johnny', | |
| last_name: 'Smith', | |
| annual_income: 120000, | |
| tax_paid: 28000 | |
| }, |
This file contains hidden or 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
| #!/user/bin/env ruby | |
| require "csv" | |
| class Tracker | |
| attr_reader :balance | |
| def initialize | |
| @balance = 0 | |
| @income = 0 | |
| @expenses = 0 | |
| @overdraft = 0 |
This file contains hidden or 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 Car | |
| @@makes_models = [] | |
| def self.add_make(make, *model) | |
| models = [] | |
| make_model = {} | |
| models << model | |
| make_model[make] = models | |
| @@makes_models << make_model | |
| end |
This file contains hidden or 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 Animal | |
| attr_reader :name | |
| def initialize | |
| end | |
| def sound | |
| "ajclvkja" | |
| end | |
| def emote |
This file contains hidden or 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 PigLatinTranslation | |
| def initialize(phrase) | |
| @phrase = phrase | |
| @translated_phrase = [] | |
| words | |
| puts @translated_phrase.join(' ').capitalize | |
| end | |
| #provide the pig latin translation | |
| def translate(word) |
This file contains hidden or 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 Circle | |
| def initialize(radius) | |
| @radius = radius | |
| end | |
| def perimeter | |
| (Math::PI * @radius * 2).round(3) | |
| end | |
| def area |
This file contains hidden or 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
| 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') |