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
puts "What is the amount due?" | |
amt_due = gets.to_f | |
puts "What is the amount tendered?" | |
amt_tnd = gets.to_f | |
if amt_tnd == amt_due | |
puts "========== Thank You! ============" | |
puts Time.now.strftime("%m/%d/%Y %l:%M") | |
puts "==================================" | |
else |
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
# CASH 2 | |
subtotal_arr = [] | |
puts "What is the sale price?" | |
amt_due = gets.chomp.downcase | |
puts | |
while amt_due != "done" |
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
favorite_movies = [ | |
{ title: 'The Big Lebowski', year_released: 1998, director: 'Joel Coen', imdb_rating: 8.2 }, | |
{ title: 'The Shining', year_released: 1980, director: 'Stanley Kubrick', imdb_rating: 8.5 }, | |
{ title: 'Troll 2', year_released: 1990, directory: 'Claudio Fragasso', imdb_rating: 2.5 } | |
] | |
favorite_movies.each do |movie| | |
puts "#{movie[:year_released]}: #{movie[:title]}" | |
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
#### CASH 3 #### | |
require 'csv' | |
require 'pry' | |
# Commands | |
def sku(array, num) | |
array[num-1][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
scores = [75, 100, 85, 65, 84, 87, 95] | |
def average(array) | |
sum = 0 | |
array.each do |score| | |
sum = sum + score | |
end | |
return sum / array.count | |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Slacker News</title> | |
<link rel="stylesheet" href="styles.css"> | |
</head> | |
<body> | |
<div id="container"> | |
<div class="nav"> |
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
CREATE TABLE recipes (id serial, name varchar(255) NOT NULL, directions TEXT); | |
CREATE TABLE ingredients (id serial, items TEXT); | |
INSERT INTO recipes (name, directions) | |
VALUES ('Green Eggs & Ham', '1. Cook the eggs. | |
2. Cook the ham. | |
3. Combine.'); | |
INSERT INTO recipes (name, directions) | |
VALUES ('Fried Green Tomatoes', '1. Slice the tomatoes 1/2 inch thick. |
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 Card | |
def initialize(rank = nil, suit = nil) | |
if suit.nil? | |
@suit = ['♠', '♣', '♥', '♦'].sample | |
else | |
@suit = suit | |
end | |
if rank.nil? | |
@rank = ((2..10).to_a + ["A", "J", "Q", "K"]).sample |
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 TV | |
def initialize(model = nil, size = nil, resolution = nil) | |
if model.nil? | |
@model = ["Sony", "LG", "Samsung", "Vizio"].sample | |
else | |
@model = model | |
end | |
if size.nil? | |
@size = [19, 28, 30, 32, 36, 38, 42, 52].sample |
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 Car | |
def initialize(color, owner, cylinders) | |
@color = color | |
@owner = owner | |
@cylinders = cylinders | |
end | |
def color | |
@color | |
end |
OlderNewer