Skip to content

Instantly share code, notes, and snippets.

View kaibrabo's full-sized avatar
💭
out with Pele (my dog)

Kainoa Ubaldo-Brabo kaibrabo

💭
out with Pele (my dog)
View GitHub Profile
Hey guys!
I am a little stuck on Title Case checkpoint on Ruby Arrays.
“We will need to use conditional logic --if and else statements -- to make this work. Read the test specification carefully so you understand the conditional logic to be implemented.
Some helpful methods to use are:
String#downcase
String#capitalize
=begin
Define a Title class which is initialized by a String.
It has one method --fix-- that returns a title-cased version of the String:
Title.new("a title of a book").fix
#=> A Title of a Book
We will need to use conditional logic --if and else statements -- to make this work. Read the test specification carefully so you understand the conditional logic to be implemented.
Some helpful methods to use are:
=begin
Define a method called frequency_table that will take a String as an argument and return a frequency table (using the Hash class),
where each key is a word in the String and it's value is the number of times the word occurs in the sentence.
The method should not be case sensitive. Assume that the input will always be a String.
Return an empty Hash for an empty String.
=end
=begin
test:
@kaibrabo
kaibrabo / bloccit-rails-console-assignment
Created July 18, 2017 08:55
bloccit-rails-console-assignment
[4] pry(#<Post>):1> nesting
Nesting status:
--
0. main (Pry top level)
1. #<Post>
[5] pry(#<Post>):1> self.to_s
=> "#<Post:0x007fefcd2275a8>"
[6] pry(#<Post>):1> self.title = 'some new title'
=> "some new title"
[7] pry(#<Post>):1> self.body = 'some new body'
n = gets.strip.to_i
a = Array.new(n)
for a_i in (0..n-1)
a_t = gets.strip
a[a_i] = a_t.split(' ').map(&:to_i)
arr = a[a_i]
end
a_diagonal = (0...arr.length).collect { |h|
n = gets.strip.to_i
a = Array.new(n)
for a_i in (0..n-1)
a_t = gets.strip
a[a_i] = a_t.split(' ').map(&:to_i)
arr = a[a_i]
end
a_diagonal = (0...arr.length).collect { |h|

##JavaScript

Hey mentor,

I was working through an assignment last night and came across a bug. I'm so confused!

The text in the alert is showing up as "undefined" instead of either "A Unicorn", "A hug", or "Fresh Laundry" and I'm not quite sure what's going on. Can you point me in the right direction?

-Student

public class Loan {
public static void main(String[] args) {
//TO DO
}
private double annualInterestRate;
private int numberOfYears;
private double loanAmount;
private java.util.Date loanDate;