Question: Strings username 1 and domain 1 are read from input. Complete the try block to output Sending email to followed by username 1 and
Strings username and domain are read from input. Complete the try block to output "Sending email to followed by username and domain with error checking:
If usernames length is or throw a runtime exception with the message "User name's length must be between and
If domain does not start with @ throw a runtime exception with the message "Domain must start with @
Ex: If input is Leroy @lentil, then the output is:
Sending email to Leroy@lentil
Ex: If input is Kjerstin @lentil, then the output is:
Error: User name's length must be between and
Ex: If input is Leroy peach, then the output is:
Error: Domain must start with @
Notes:
usernamelength returns the length of string username
domain ch returns true if the first character of domain is not character ch c
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
