Skip to content

Instantly share code, notes, and snippets.

View justuseapen's full-sized avatar

Justus Eapen justuseapen

View GitHub Profile
puts "What would you like to say?"
phrase = gets.chomp
def lots_to_say
phrases = []
puts "Ok, let's hear it!"
input = ""
while input != "done"
input = gets.chomp
if input == "done"
class Card
def initialize(rank = nil, suit = nil)
if suit.nil?
@suit = ['♠', '♣', '♥', '♦'].sample
else
@suit = suit
end
if rank.nil?
@rank = [2..10,'J','Q','K','A'].sample
puts "Create a new card: #{@rank} of #{@suit}"
class Television
def initialize(size,brand)
@size = size
@brand = brand
end
end
class TVChannel
def initialize(name,channel_number,parent_company)
@name = name
class Car
def initialize(color, owner, cylinders)
@color = color
@owner = owner
@cylinders = cylinders
end
def color
@color
end
class Card
def initialize(rank, suit)
@suit = suit
@rank = rank
end
def rank
@rank
end
class Whiteboard
attr_accessor :contents
def initialize(contents = [])
@contents = contents
end
def wipe_board
@contents = []
end
class Whiteboard
attr_accessor :contents
def initialize(contents = [])
@contents = contents
end
def wipe_board
@contents = []
end
# Implement your solution here. You may reference any additional files from here as well.
@results = []
def team_names_and_scores
puts "What was team one's name?"
team1 = gets.chomp
puts "What was team one's score?"
team1_score = gets.chomp
# Implement your solution here. You may reference any additional files from here as well.
@results = []
def team_names_and_scores
puts "What was team one's name?"
team1 = gets.chomp
puts "What was team one's score?"
team1_score = gets.chomp
class Circle
def initialize(radius)
@radius = radius
end
def diameter
@diameter = @radius * 2
end
def circumference
Math::PI*@diameter
end