Output the following results using quote variable in the Scala REPL:
Quote: "This is homework - and it is hard! We will learn a lot in this course."
Number of non-capitalized words. Hint: split along spaces to get a new collection.
// Declare the Quote variable scala> val Quote= "This is homework - and it is hard! We will learn a lot in this course." // split the string using split(" ") method . It will give us array of strings scala> val qteArr:Array[String]=Quote.split(" ") scala> var count =0 // in for loop iterate over array & check each string for Uppercase scala> for(i <- 0 until qteArr.length) | { | val bUpper= qteArr(i).exists(_.isUpper) | if (bUpper == false) | { | count += 1 | } | } scala> println(count)
scala repl screen :
Output the following results using quote variable in the Scala REPL: Quote: "This is homework -...