This file contains hidden or 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
# 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 |
This file contains hidden or 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
# 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" |