Email name for an employee

Report a typo

Erick wants to create a function createEmail() that uses a strings.Builder to create company emails for employees with the initial of their first name, followed by the last name and then the domain.

He has already written the code to read from the input two strings with the firstName and lastName of the employees, and another string with the email domain.

Your task is to help Erick write the required additional code to concatenate the initial of the firstName, then the lastName and the domain using a strings.Builder within the createEmail() function.

It is guaranteed that both the firstName and lastName are only composed of letters from the Latin alphabet.

Sample Input 1:

Elon Musk @tesla.com

Sample Output 1:

Write a program in Go
package main

import (
"fmt"
"log"
"reflect"
"strings"
)

// Write the code to concatenate `firstName`, `lastName`,
// and `domain` into an email address using the strings.Builder
func createEmail(firstName, lastName, domain string) strings.Builder {
var builder strings.Builder

return builder
}

// DO NOT delete or modify the code within the main() function!
func main() {
var firstName, lastName, domain string
fmt.Scanln(&firstName, &lastName, &domain)

email := createEmail(firstName, lastName, domain)
if !isBuilder(email) {
log.Fatal("Wrong! the createEmail function must return a strings.Builder type")
}
fmt.Println(email.String())
}
___

Create a free account to access the full topic