Question: Use scala language please cops loca at -398 Advanced Applied Programming (2nd Exam) 17) The following Scala statement stores extracted information[19 by applying a regular
cops loca at -398 Advanced Applied Programming (2nd Exam) 17) The following Scala statement stores extracted information[19 by applying a regular expression into each variable. Write a class Connection In the following Scala example, identify the possible error? regular-expression pattern of strings. Note that the regular def nakeConnection expression only works with the street name that has a white val timeout 1ee val protocol 180 printin("timeout ., protocol- %s".fomat(tisecut, protocol)) space character in the middle. scala> val pattern(housenum, streetname, aptnum) 180 District Avenue 509* housenum: String 100 streetnane: String District Avenue aptnum: String ses val c new Connection c.makeConnection() scala val pattern(housenum, streetnase, aptnum) 298e NonameStreet 100 scala.MatchError: 298e NonameStreet 1ee (of class dava.lang.String) 28 elided [20] You are trying to create a method that performs a division operation and returns both quotient and remainder Complete the method c" division") def division (dividend: Int, divisor: Int) - [18] Create a class declaration to support the following object creations. You are not allowed to use case class. scala> val obj1 People("James") obj1: People " (James, , unknown) scalay val (quotient, remainder) division(589, 3) quotient: Int 166 remainder: Int 2 scala> val obj2 People( James ,22, "Officer") Lob2: People (lames 22, Officer)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
