Skip to content

Instantly share code, notes, and snippets.

@betsy-nird
betsy-nird / wine_glass.rb
Created June 14, 2012 04:58 — forked from reneedv/wine_glass.rb
Wine Glass Homework 1
# Make the existing tests pass.
# Add 2 more tests and methods for:
## 1. Another print method for material, volume, and stem_length all together
## 2. A method that calculates and returns the percent of the glass that is full when you pass in the
### volume of liquid in the glass.
### This calculation is: (volume_passed_to_method / volume_of_wine_glass) * 100
class WineGlass
attr_accessor :material, :volume, :stem_length, :volume_of_wine
def pretty_print_material
@betsy-nird
betsy-nird / fizz_buzz.rb
Created June 14, 2012 05:01 — forked from reneedv/fizz_buzz.rb
FizzBuzz Homework 1
# Write a Ruby script that prints the numbers from 1-100,
# replacing every multiple of 3 with the word Fizz,
# replacing every multiple of 5 with the word Buzz,
# and replacing every multiple of both with the word FizzBuzz
#
def fizzbuzz
array = Array (1..100)
array.each do |number|
if number % 15 == 0
puts "FizzBuzz"