Skip to content

Commit

Permalink
week 1
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywengrow committed Jan 1, 2016
0 parents commit d10ef20
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
21 changes: 21 additions & 0 deletions 1/algo/find_longest_word.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Complete the method called find_longest_word, which will accept a string as a parameter (usually a sentence), and return another string that will be the longest word in that sentence.

def find_longest_word(sentence)

end

# Driver code - don't touch anything below this line.
puts "TESTING find_longest_word..."
puts

result = find_longest_word("What is the longest word in this phrase?")

puts "Your method returned:"
puts result
puts

if result == "longest"
puts "PASS!"
else
puts "F"
end
23 changes: 23 additions & 0 deletions 1/algo/reverse_a_string.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Complete the method called reverse_a_string that accepts a string as a parameter and
# returns the reverse. The one caveat: Don't use the reverse method that already
# comes with Ruby!

def reverse_a_string(string)

end

# Driver code - don't touch anything below this line.
puts "TESTING reverse_a_string..."
puts

result = reverse_a_string("abcde")

puts "Your method returned:"
puts result
puts

if result == "edcba"
puts "PASS!"
else
puts "F"
end
48 changes: 48 additions & 0 deletions 1/oop/person.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Create a person class with readable first_name and last_name attributes
# and a method to calculate its full_name.



# Driver code - don't touch anything below this line.
puts "TESTING the Person class..."
puts

person = Person.new("Peter", "Jang")

result = person.first_name

puts "first_name returned:"
puts result
puts

if result == "Peter"
puts "PASS!"
else
puts "F"
end
puts

result = person.last_name

puts "last_name returned:"
puts result
puts

if result == "Jang"
puts "PASS!"
else
puts "F"
end
puts

result = person.full_name

puts "full_name returned:"
puts result
puts

if result == "Peter Jang"
puts "PASS!"
else
puts "F"
end
48 changes: 48 additions & 0 deletions 1/oop/rectangle.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Create a Rectangle class with readable width and height attributes
# and a method to calculate its area.



# Driver code - don't touch anything below this line.
puts "TESTING the Rectange class..."
puts

rectangle = Rectangle.new(10, 30)

result = rectangle.width

puts "width returned:"
puts result
puts

if result == 10
puts "PASS!"
else
puts "F"
end
puts

result = rectangle.height

puts "height returned:"
puts result
puts

if result == 30
puts "PASS!"
else
puts "F"
end
puts

result = rectangle.area

puts "area returned:"
puts result
puts

if result == 300
puts "PASS!"
else
puts "F"
end
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Weekend Practice

These weekend exercises are designed to help you level up in two different areas: Algorithms and Object Oriented Programming. We *strongly* encourage you to complete these exercises over the weekend. We've tried to keep them brief but powerful. On Sunday, we'll review the solutions to the exercises from that week.

Each folder has a number, and you'll be assinged a particular number each weekend, but feel free to move ahead at any time.

## Algorithms

These problems are designed to help you practice becoming a fluent programmer. They are short and sweet, much like the types of questions you will be asked in a job interview.

You shouldn't be very concerned with getting the "right" answer as fast as possible. Rather, you should focus on improving with each problem. If it takes you a while to remember the syntax for writing a method or looping through a list, keep practicing and focusing on those skills. With enough practice, it will become second nature.

Each problem has driver code at the bottom so you can test your solution by running the code in Sublime (Command + B). If you're familiar with rspec, you should run the appropriate spec file for more accurate testing.

## OOP

Object Oriented Programming is one of the most fundamental skills as a programmer, and you'll want to get really good at it. These exercises will help you get there.

## Usage

Each problem has driver code at the bottom so you can test your solution by running the code in Sublime (Command + B). Alternatively, you can run each file from the terminal as well.

0 comments on commit d10ef20

Please sign in to comment.