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 / cash register
Created November 14, 2013 23:11
Calculate Change from a Transaction.
#Cash Register App by Van Nguyen and Dani Dewitt
require 'date'
puts "What is the amount due?"
amount_due = gets.chomp
puts "What is the amount tendered?"
amount_tendered = gets.chomp
@vanmichael
vanmichael / log for check in
Created November 14, 2013 23:41
git for check in app
commit 6a2541b88856470e26b4ac65aa19e4c51a4a3483
Author: Van Michael <SorryIDon'tWantCrawlers@gmail.com>
Date: Thu Nov 14 18:38:58 2013 -0500
Did This Work
(END)
#Van's Cash Register
require 'date'
require 'time'
price = 0
items = []
sub_total = 0
def numeric?(object)
#Cashier.rb
require './register.rb'
require 'pry'
cashier = Register.new
while cashier.get_sale_price != "done"
cashier.add_sale_price_to_list
cashier.calculate_sub_total
@vanmichael
vanmichael / guess.rb
Created November 17, 2013 04:31
#Only validation that is not filtered is any guess that begins with 0 etc. 0123
class Guess
attr_accessor :guess, :number
def initialize
@number = 50
end
def valid_input?(input)
if (input !~ /\A\$?\d+(\.\d{1,2})?\z/) == false
return false
@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
@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"
salutations = [
'Mr.',
'Mrs.',
'Mr.',
'Dr.',
'Ms.'
]
first_names = [
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,
@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