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
#All I need in life are my favorite movies and an array of hash. | |
favorite_movies = [ | |
{ title: 'The Big Lebowski', year_released: 1998, director: 'Joel Coen', imdb_rating: 8.2 }, | |
{ title: 'The Shining', year_released: 1980, director: 'Stanley Kubrick', imdb_rating: 8.5 }, | |
{ title: 'Troll 2', year_released: 1990, directory: 'Claudio Fragasso', imdb_rating: 2.5 } | |
] | |
favorite_movies.each do |movie| | |
puts "#{movie[:year_released]}: #{movie[:title]}" |
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
#Echo Phase 1 | |
class Echo | |
def initialize | |
get_input | |
play_back(@input) | |
end | |
def get_input |
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
#Echo Phase 2 | |
class Echo | |
def initialize | |
get_input | |
if @input == "Nothing!" | |
puts "Ok, fine!" | |
elsif @input == "I have a lot to say" |
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
#Echo Phase 3 | |
class Echo | |
def initialize | |
get_input | |
if @input == "Nothing!" | |
puts "Ok, fine!" | |
elsif @input == "I have a lot to say" | |
respond_to_alot |
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
#Echo Phase 4 | |
class Echo | |
def initialize | |
@comments = [] | |
get_input | |
if @input == "Nothing!" | |
puts "Ok, fine!" | |
elsif @input == "I have a lot to say" |
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 House | |
attr_reader :character, :house, :selection | |
def initialize | |
@characters = { | |
"Tyrion Lannister" => "House Lannister", | |
"Jon Snow" => "Night's Watch", |
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
#The Change Machine | |
#by van | |
class Change | |
attr_reader :dollars, :quarters, :dimes, :pennies, :change | |
def initialize | |
get_amount_due | |
get_amount_tendered |
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
#By Van and Collin | |
require './register.rb' | |
require 'pry' | |
cashier = Register.new | |
cashier.load_products("products.csv") | |
while cashier.get_selection != 'done' | |
if cashier.menu_selection == '1' | |
while cashier.get_item != 'done' do |
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 Card | |
def initialize(rank = nil, suit = nil) | |
if suit.nil? | |
@suit = ['♠', '♣', '♥', '♦'].sample | |
else | |
@suit = suit | |
end | |
if rank.nil? | |
@rank = ['2','3','4','5','6','7','8','9','10','J','Q','K'].sample | |
else |
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 television | |
def initialize(model, size, color) | |
@model = model | |
@size = size | |
@color = color | |
end | |
end | |
class channel(number,broadcaster) | |
def initialize(number,broadcaster) |