Passport number

Report a typo

There is a hidden passport number in our Person class. Write a method passportLastDigits that will return only the last 4 digits of the passport number.

class Person(val name: String, val surname: String, private val passportNumber: String)

Sample Input 1:

Person("Bob", "Brown", 53445755)

Sample Output 1:

5755
Write a program in Scala 3
class Person(val name: String, val surname: String, private val passportNumber: String):
// Write your code here
___

Create a free account to access the full topic