Skip to content

Instantly share code, notes, and snippets.

View vanmichael's full-sized avatar

van nguyen vanmichael

  • OpenTable
  • San Francisco
View GitHub Profile
@vanmichael
vanmichael / echo.rb
Created November 25, 2013 02:43
Phase 4
#Echo Phase 4
class Echo
def initialize
@comments = []
get_input
if @input == "Nothing!"
puts "Ok, fine!"
elsif @input == "I have a lot to say"
@vanmichael
vanmichael / echo.rb
Last active December 29, 2015 06:48
Phase 3
#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
@vanmichael
vanmichael / echo.rb
Created November 24, 2013 18:20
Phase 2
#Echo Phase 2
class Echo
def initialize
get_input
if @input == "Nothing!"
puts "Ok, fine!"
elsif @input == "I have a lot to say"
@vanmichael
vanmichael / echo.rb
Last active December 29, 2015 05:39
Phase 1
#Echo Phase 1
class Echo
def initialize
get_input
play_back(@input)
end
def get_input
#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]}"
@vanmichael
vanmichael / cashier.rb
Created November 22, 2013 21:15
Challenge 4
require './register.rb'
require 'pry'
cashier = Register.new
#Load Inventory List from CSV
cashier.load_products("products.csv")
#Display Menu
#cashier.display_menu
train_times = { 1 => 2,
2 => 5,
3 => 7.5,
4 => 8.5,
5 => 9,
6 => 10,
7 => 11.5,
8 => 13.5,
9 => 14.5,
salutations = [
'Mr.',
'Mrs.',
'Mr.',
'Dr.',
'Ms.'
]
first_names = [
@vanmichael
vanmichael / cashier.rb
Created November 20, 2013 00:12
Cash Register with Hash to store Quantity
#Cashier
require './register.rb'
puts "Welcome to James' Coffee Emporium!"
puts "1) Add item - $5.00 - Light Bag "
puts "2) Add item - $7.50 - Medium Bag"
@vanmichael
vanmichael / list_stats.rb
Last active December 28, 2015 13:49
#Reads a .txt file and puts each line in array in order to report the average, lowest and highest score.
#List Statistics by Van
require './statistics.rb'
mathmatician = Statistics.new
mathmatician.read_file
puts ""
mathmatician.report_average_score
mathmatician.report_highest_score
mathmatician.report_lowest_score