Hi All,
I am new to Scala and currently doing hands on as part of learning Scala.
I need assistance with below hands on, which I believe is matching the requirement but HackerRank test case is failing. Not sure what exactly the issue.
Question :
Program I did for the same :
object Result {
// Create a case class book with name(string) and author(string)
case class book(name:String,author:String)
def describe() {
//Create the two case class objects as described in the statement
val book1 = Result.book(“Scala for the impatient”,“Cay S. Horstmann”)
val book2 = Result.book(“Scala Cookbook”,“Alvin Alexander”)
//Print the details here
println (s"Author of this ${book1.name} is ${book1.author}")
println (s"Author of this ${book2.name} is ${book2.author}")
}
}
object Solution {
def main(args: Array[String]) {
Result.describe()
}
}
Output received after running the HackerRank test case :
No test case passed. Use print or log statements to debug why your hidden test cases are failing. Hidden test cases are used to evaluate if your code can handle different scenarios, including corner cases.
Test case 0
Your Output (stdout)
-
Author of this Scala for the impatient is Cay S. Horstmann
-
Author of this Scala Cookbook is Alvin Alexander