Skip to content

Instantly share code, notes, and snippets.

View ckaltenbach904's full-sized avatar
💭
I may be slow to respond.

catharina kaltenbach ckaltenbach904

💭
I may be slow to respond.
View GitHub Profile
@ckaltenbach904
ckaltenbach904 / pets.rb
Created April 15, 2019 16:04
exercise 3.5
class Pet
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
@ckaltenbach904
ckaltenbach904 / cat.rb
Last active April 8, 2019 15:38
exercise 3.4
class Cat
attr_reader :color, :breed, :name
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
def feed(food)
puts "Mmmm, " + food + "!"
def fav_foods
# code from this method goes in here
food_array = []
3.times do
puts "Name a favorite food"#expecting input from the user and set to food_array
food_array << gets.chomp
end#end of food_array
p food_array
puts "Your favorite foods are #{food_array.join(", ")}."
food_array.each do |food| # do something to each element in food_array; that element is to be referred to as food
puts "hello"
p "hello"
my_name = "Catharina"
greeting("Catharina")
def greeting(name)# here we define a method called "greeting" and an argument "name" within a parentheses.
p "hello " + "" + name
end #closing method
@ckaltenbach904
ckaltenbach904 / cloudSettings
Last active August 14, 2019 13:59
cf_template_3.1
{"lastUpload":"2019-08-14T13:59:04.848Z","extensionVersion":"v3.4.1"}
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">