Skip to content

Instantly share code, notes, and snippets.

@adamjonas
adamjonas / assignment.rb
Created October 12, 2012 03:04
Friday Oct 12
# Assignment
# write a true expression using ==
a == a
# write a false expression using ==
a == b
# write a true expression using !=
true != false
# write a false expression using !=
@adamjonas
adamjonas / FizzBuzz.rb
Created October 9, 2012 02:12
FizzBuzz
# Define the fizzbuzz method to do the following: 10pts
# Use the modulo % method (divisible by)
# 2 % 2 #=> true
# 1 % 2 #=> false
# If a number is divisible by 3, puts "Fizz".
# If a number is divisible by 5, puts "Buzz".
# If a number is divisible by 3 and 5, puts "FizzBuzz"
# Use if statements 2pts
@adamjonas
adamjonas / Quiz 1
Created October 9, 2012 02:11
assignment1
# Write a program that tells you the following:
#
# Hours in a year. How many hours are in a year? - 6pts
# Minutes in a decade. How many minutes are in a decade? - 6pts
# Your age in seconds. How many seconds old are you? - 6pts
#
# Define at least the following methods to accomplish these tasks:
#
# seconds_in_minutes(1) #=> 60 - 3pts
# minutes_in_hours(1) #=> 60 - 3pts
@adamjonas
adamjonas / blane_final
Created July 9, 2012 17:45
Missing Pieces of Blane's Final
class Artist
def genres
@songs.collect{|s| s.genre}
end
end
class Song
attr_accessor :name, :song, :artist, :genre
def genre=(genre)