Skip to content

Instantly share code, notes, and snippets.

View samwillis4216's full-sized avatar

Sam Willis samwillis4216

View GitHub Profile
class Patient
attr_reader :name
attr_accessor :room
attr_accessor :id
# attr_reader :room
# attr_writer :room
# to assign initial values to the patient instance when we create
def initialize(attributes = {})
# TODO: you can build your horse race program here!
# 1. Create a list of horses taking part in the race (an array to store horse names)
# e.g ["bob", "racing stripes", "happy feet"]
# 2. Define the balance (amount of money that they have on them) the user has
# e.g 1000
# 3. Display the horse names with their running number to the user (puts)
# e.g 1. bob
# 2. racing stripes
def calculate(num1, num2, operator)
# if operator == "+"
# return num1 + num2
# elsif operator == "-"
# return num1 - num2
# elsif operator == "/"
# return num1 / num2
# elsif operator == "*"
# return num1 * num2
# TODO: you can build your instacart program here!
# NOTE: we will not worry about the quantity of same item the user wants to buy
# Just assume the user will only buy one of an item
# 1. Greet the user
# 2. Define a list of items being sold e.g milk 1, bread 2, jam 5
# Note that we need to store the name of the item and the price of the item (Hash)
# 3. Create an empty shopping basket for the user (Array)
# 4. Need to display the items and their prices on sale at the store
class Animal
def name(name)
# self -> #<Animal:0x00007fccb4048ea8>
@name = name
# TODO: what should this method return?
# self -> #<Animal:0x00007fccb4048ea8 @name="max">
self
end
def species(species)
class Restaurant
# TODO: add relevant accessors if necessary
attr_reader :average_rating, :city
def initialize(city, name)
# TODO: implement constructor with relevant instance variables
@city = city
@name = name
@sum_of_all_rating = 0
@num_of_ratings = 0
RSpec::Support.require_rspec_core 'formatters/base_text_formatter'
class BonusFormatter < RSpec::Core::Formatters::DocumentationFormatter
RSpec::Core::Formatters.register self, :dump_summary
def dump_summary(notification)
output.puts BONUS if notification.failure_count.zero?
super notification
end
end
<html>
<head>
<meta charset="utf-8">
<title>Bootstrap demo</title>
<!-- Need to read device screen width (Bootstrap) -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<html>
<head>
<meta charset="utf-8">
<title>Bootstrap demo</title>
<!-- Need to read device screen width (Bootstrap) -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
gistup