This file contains 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 story: As a cashier | |
#I want to calculate the change due | |
#So I know how much to give back to the customer | |
t = Time.now | |
puts "What is the amount due?" | |
amount_due = gets.chomp.to_f | |
puts "What is the amount tendered?" |
This file contains 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
studentsarray = ["Anthony", "Greg", "Dan", "Rohan", "Lydia", "Lee", "Chris", "Charlie", "Barry", "Julissa", "Victor", "Arnold"] | |
def groupsplit(array) | |
group1 = [] | |
group2 = [] | |
array.each_with_index do |x, i| | |
if i >= (array.length / 2) | |
group1 << x | |
else | |
group2 << x |
This file contains 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
=begin | |
As a cashier | |
I want to enter the sale price of each item | |
So that the program will calculate the amount due | |
Developed by: Anthony Ross, Dan Clarke, and Greg Sheppard | |
=end | |
def sub_total(array) | |
subtotal_amt = 0.0 | |
array.each do |x| | |
subtotal_amt += x |
This file contains 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
characters = { | |
"Tyrion Lannister" => "House Lannister", | |
"Jon Snow" => "Night's Watch", | |
"Hodor" => "House Stark", | |
"Stannis Baratheon" => "House Baratheon", | |
"Theon Greyjoy" => "House Greyjoy" | |
} | |
characters.each do |key, value| | |
puts "#{key} represents the #{value}" |
This file contains 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
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 |value| | |
puts "#{value[:year_released]}: #{value[:title]}" | |
end |
This file contains 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
test_scores = [75, 100, 85, 65, 84, 87, 95] | |
def avg(array) | |
sum = 0.0 | |
array.each do |x| | |
sum += x | |
end | |
(sum / array.length).round(2) | |
end |
This file contains 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
commit 9bd028731a8f3c71ba0c93b80bb4c0c85af0adad | |
Author: Anthony Ross <[email protected]> | |
Date: Sat Feb 22 16:43:10 2014 -0500 | |
made minor change to list to test git | |
commit fda290c9c66e54b7ef9ea827342ade43b05dabef | |
Author: Eric Kelly <[email protected]> | |
Date: Mon Apr 29 06:21:42 2013 -0400 |
This file contains 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 | |
def initialize(color, owner, cylinders) | |
@color = color | |
@owner = owner | |
@cylinders = cylinders | |
end | |
def color | |
@color | |
end |
This file contains 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 'rubygems' | |
require 'csv' | |
require 'json' | |
require 'pry' | |
require 'oauth' | |
consumer_key = '' | |
consumer_secret = '' | |
token = '' | |
token_secret = '' |
This file contains 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 'pp' | |
require 'pry' | |
require 'csv' | |
class Importer | |
def self.get(filename) | |
violations = [] | |
CSV.foreach(filename, headers: true) do |csv| | |
violations << Violation.new( | |
csv[0], |
OlderNewer