This file contains 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
#Getting Started,1 | |
#Numbers,9 | |
#Letters,13 | |
#Variables and Assignment,21 | |
#Mixing It Up,25 | |
#More About Methods,33 | |
require 'csv' | |
class TableOfContents |
This file contains 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
#binary search | |
def binary_search(item,array,min = 0,max = array.length, half = (min + max) / 2) | |
return min if item == array[min] | |
return -1 if (item < array[0] || item > array[array.length-1]) || (min == max - 1) | |
item < array[half] ? binary_search(item,array,min,half) : binary_search(item,array,half,array.length) | |
end | |
test_array = (1..15).to_a | |
puts binary_search(13,test_array) == 12 |
This file contains 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 NumbersToWords | |
@@words = { 1=> "one", | |
2=>"two", | |
3=>"three", | |
4=>"four", | |
5=>"five", | |
6=>"six", | |
7=>"seven", | |
8=>"eight", |
This file contains 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
MAX_AGE = 120 | |
class OrangeTree | |
def initialize | |
@height_total_inches = 0 | |
@age = 0 | |
@orange_count = 0 | |
end |
This file contains 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 Hospital | |
#name, location, number of employees | |
#number of patients | |
#login, show interface | |
#wait for user input | |
#present login menu | |
#accept credentials | |
#credentials are associated on a employee level | |
end |
This file contains 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
#questions : | |
#1. how to check if file exists? Better way than opening with 'append' (+)? | |
#2. how to write to middle of file? does the entire file need to be re-written from the contents in memory? | |
class TodoList | |
def initialize() | |
@file_name = "todo_file.txt" | |
@file = File.new(@file_name,'r+') | |
@todo_list = {} |
This file contains 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
require 'securerandom' | |
class Hospital | |
attr_accessor :name,:location | |
def initialize | |
@name = "Dev Bootcamp Asylum?" | |
@location = "717 California St" | |
@employee_count = 7 |
This file contains 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
require './user' | |
require './employee' | |
class Administrator < Employee | |
def initialize(name) | |
super | |
@record_access = :admin | |
@title = "Administrator" | |
@password = default_password | |
end |
This file contains 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
require './binary_search' | |
# your rspec code here! | |