Exercise: Processing User Information

Enhance your Kotlin proficiency by implementing and managing user data through precise rules and exception handling.

We'll cover the following

Problem statement

Implement the processUserInformation function according to the following rules:

  • If the input user is null, return "Missing user information".

  • If name from user is null, return "Missing name".

  • If age from user is null, treat it as 0.

  • If email from user is null or contains a blank email address, return "Missing email".

  • Otherwise, return information about the user in the following format: "User $name is $age years old, email: $email".

Instructions

In the provided code, you are presented with the initial setup of data classes EmailAddress and User, along with the processUserInformation function. Your task is to complete the implementation of the processUserInformation function according to the specified rules and requirements.

The actual output when running the provided code should be as follows:

Get hands-on with 1200+ tech skills courses.