Created
May 28, 2017 23:29
-
-
Save monroemann/7158792e60707ca5a23efce69fa0e8fa to your computer and use it in GitHub Desktop.
Firehose Class Quiz
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
class Computer | |
attr_accessor :make, :model | |
def initialize(make, model) | |
@make = make | |
@model = model | |
end | |
def output_computer | |
puts "Check out the new #{self.make} #{self.model}" | |
end | |
end | |
class Type | |
def initialize | |
@computers = [] | |
#BUILD MACS | |
@computers << Computer.new(:mac, :iBook) | |
@computers << Computer.new(:mac, :laptop) | |
@computers << Computer.new(:mac, :iMac) | |
@computers << Computer.new(:mac, :iMacpro) | |
#BUILD PCS | |
@computers << Computer.new(:Dell, :desktop) | |
@computers << Computer.new(:Dell, :laptop) | |
@computers << Computer.new(:Microsoft, :surface) | |
@computers << Computer.new(:Toshiba, :laptop) | |
end | |
def shuffle | |
@computers.shuffle! | |
end | |
def deal | |
@computers.shift | |
end | |
def output | |
@computers.each do |computer| | |
computer.output_computer | |
end | |
end | |
end | |
type = Type.new | |
type.shuffle | |
type.output | |
type.output_computer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment