8 kyu

Sleigh Authentication

8,664 of 22,994BattleRattle

Description:

Christmas is coming and many people dreamed of having a ride with Santa's sleigh. But, of course, only Santa himself is allowed to use this wonderful transportation. And in order to make sure, that only he can board the sleigh, there's an authentication mechanism.

Your task is to implement the authenticate() method of the sleigh, which takes the name of the person, who wants to board the sleigh and a secret password. If, and only if, the name equals "Santa Claus" and the password is "Ho Ho Ho!" (yes, even Santa has a secret password with uppercase and lowercase letters and special characters :D), the return value must be true. Otherwise it should return false.

Examples:

var sleigh = new Sleigh();
sleigh.authenticate("Santa Claus", "Ho Ho Ho!"); // must return TRUE

sleigh.authenticate("Santa", "Ho Ho Ho!"); // must return FALSE
sleigh.authenticate("Santa Claus", "Ho Ho!"); // must return FALSE
sleigh.authenticate("jhoffner", "CodeWars"); // Nope, even Jake is not allowed to use the sleigh ;)
sleigh = Sleigh()
sleigh.authenticate('Santa Claus', 'Ho Ho Ho!') # must return True

sleigh.authenticate('Santa', 'Ho Ho Ho!') # must return False
sleigh.authenticate('Santa Claus', 'Ho Ho!') # must return False
sleigh.authenticate('jhoffner', 'CodeWars') # Nope, even Jake is not allowed to use the sleigh ;)
authenticate "Santa Claus" "Ho Ho Ho!" -- True
authenticate "Santa"       "Ho Ho Ho!" -- False
authenticate "Santa Claus" "Ho Ho!"    -- False
authenticate "jhoffner"    "CodeWars"  -- False
authenticate? "Santa Claus", "Ho Ho Ho!" #=> true
authenticate? "Santa",       "Ho Ho Ho!" #=> false
authenticate? "Santa Claus", "Ho Ho!"    #=> false
authenticate? "jhoffner",    "CodeWars"  #=> false
sleigh.authenticate("Santa Claus", "Ho Ho Ho!") # must return True
sleigh.authenticate("Santa', 'Ho Ho Ho!") # must return False
sleigh.authenticate("Santa Claus", "Ho Ho!") # must return False
sleigh.authenticate("jhoffner", "CodeWars") # Nope, even Jak
Fundamentals

Stats:

CreatedDec 15, 2013
PublishedDec 15, 2013
Warriors Trained26821
Total Skips1386
Total Code Submissions36743
Total Times Completed22994
JavaScript Completions8664
CoffeeScript Completions280
Ruby Completions3102
Python Completions7784
Haskell Completions503
Elixir Completions315
C# Completions971
Java Completions2240
Total Stars137
% of votes with a positive feedback rating88% of 2161
Total "Very Satisfied" Votes1722
Total "Somewhat Satisfied" Votes357
Total "Not Satisfied" Votes82
Ad
Contributors
  • BattleRattle Avatar
  • jhoffner Avatar
  • bkaes Avatar
  • cris Avatar
  • KevOrr Avatar
  • anter69 Avatar
  • MartinPescatore Avatar
  • Voile Avatar
  • Souzooka Avatar
  • KayleighWasTaken Avatar
Ad