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 Die | |
| def initialize(number_of_sides) | |
| @number_of_sides = number_of_sides | |
| end | |
| def sides | |
| @number_of_sides | |
| end | |
| def roll |
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
| require 'date' | |
| class Task | |
| def initialize(description) | |
| @description = description | |
| @status = "incomplete" | |
| @priority = 5 | |
| @due_date = Date.today.to_s | |
| end | |
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 Parcel | |
| def initialize(weight, height, width, length) | |
| @weight = weight | |
| @height = height | |
| @width = width | |
| @length = length | |
| @dimensional_weight = (@length * @width * @height)/ 166 | |
| end | |
| def dimensional_weight |
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
| require './lib/triangles' | |
| def main | |
| @sides = [] | |
| puts "Please enter a side length" | |
| @sides << gets.chomp | |
| puts "Please enter another side length" | |
| @sides << gets.chomp | |
| puts "Please enter a third side length" |
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 Address | |
| def initialize | |
| @street | |
| @city | |
| @state | |
| @type | |
| end | |
| def complete_address | |
| "#{@street} #{@city}, #{@state}" |
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 Board | |
| def initialize(grid_length) | |
| @spaces = [] | |
| @grid_length = grid_length | |
| create_spaces | |
| end | |
| attr_reader :spaces, :grid_length | |
| def create_spaces |
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 Board | |
| attr_reader :columns, :height, :width | |
| def initialize(width, height) | |
| @columns = [] | |
| @height = height | |
| @width = width | |
| width.times do |position| | |
| column = Column.new(position, height) | |
| columns << column |
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 List | |
| attr_reader :name, :id | |
| def initialize(name) | |
| @name = name | |
| end | |
| def ==(another_list) | |
| self.name == another_list.name |
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 Address | |
| attr_reader :contact_id, :street, :city, :state, :zip, :type, :full | |
| def initialize(contact_id, street, city, state, zip, type="") | |
| @contact_id = contact_id | |
| @street = street | |
| @city = city | |
| @state = state | |
| @zip = zip | |
| @type = type |
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 Book | |
| attr_reader :title, :isbn, :author_last_name, :author_first_name, :id, :copies, :number_of_copies | |
| def initialize(title, isbn, author_last_name, author_first_name, number_of_copies) | |
| @title = title | |
| @isbn = isbn | |
| @author_first_name = author_first_name | |
| @author_last_name = author_last_name | |
| @number_of_copies = number_of_copies |
OlderNewer