Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created solution, it works #107

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions lib/deaf_grandma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,21 @@ def run!

loop do
user_input = get_user_input
p speak(user_input)
puts speak(user_input)
end
end


def speak(input)

#Implement your code here <<<<<<<<<

if input == "BYE"
@bye_counter += 1
end
exit if @bye_counter >= 3
"SEE YOU LATER SONNY!"
end
return "NOT SINCE 1964!" if input == input.upcase
"SPEAK UP SONNY!"
end
end

private
Expand Down
11 changes: 8 additions & 3 deletions lib/fizzbuzz.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ class SuperFizzBuzz

def run(input)

#Implement your code here

if input % 3 == 0 && input % 5 == 0
"FizzBuzz"
elsif input % 5 == 0
"Buzz"
elsif input % 3 == 0
"Fizz"
else input
end
end

end

#You don't necessarily need to execute this script to complete this challenge, but how would you "run" this method (pun intended) so that it printed a value to the terminal?
Expand Down
7 changes: 4 additions & 3 deletions spec/deaf_grandma_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
let(:script) { DeafGrandma.new }

it "says 'SPEAK UP SONNY!' when we speak regularly" do
expect(script.speak("Hi Grandma")).to eq "SPEAK UP SONNY!"
expect(script.speak("hi Grandma")).to eq "SPEAK UP SONNY!"
expect(script.speak("some words in lowercase")).to eq "SPEAK UP SONNY!"
end

it "says 'NOT SINCE 1964!' when we yell" do
#implement your test here
expect(script.speak("HI GRANDMA")).to eq "NOT SINCE 1964!"
end

it "EXTRA CREDIT: How would you test yelling BYE?" do
#implement your test here
expect(script.speak("BYE")).to eq "SEE YOU LATER SONNY!"
end
end
8 changes: 5 additions & 3 deletions spec/fizzbuzz_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@

it "returns 'Fizz' when my input is divisible by 3" do
expect(script.run(3)).to eq "Fizz"
expect(script.run(9)).to eq "Fizz"
expect(script.run(24)).to eq "Fizz"
end

it "returns 'Buzz' when my input is divisible by 5" do
#implement your test here
expect(script.run(5)).to eq "Buzz"
end

it "returns 'FizzBuzz' when input is divisible by 3 & 5" do
#implement your test here
expect(script.run(15)).to eq "FizzBuzz"
end

it "returns the input number when input isn't divisible by 3, 5, or both" do
#implement your test here
expect(script.run(16)). to eq 16
end
end