Ask Question
2 October, 18:02

Create and test a user-defined function named ufnFullName that combines the values of the two parameters named FirstName and LastName into a concatenated name field FullName, which is formatted as FirstName LastName (including a space between FirstName and LastName)

+1
Answers (1)
  1. 2 October, 20:14
    0
    public static String ufnFullName (String Fname, String Lname) {

    String FullName = Fname+" "+Lname;

    return FullName;

    }

    Explanation:

    Using Java programming language, the function is created to accept two String parameters (Fname and Lname)

    These are concatenated into a new String FullName and returned by the function

    See below a complete code that prompts users to enter value for first and last names then calls this method to display the full name

    import java. util. Scanner;

    public class FullName {

    public static void main (String[] args) {

    System. out. println ("Enter First Name");

    Scanner in = new Scanner (System. in);

    String Fname = in. next ();

    System. out. println ("Enter Last Name");

    String Lname = in. next ();

    System. out. println ("Your Full Name is "+ufnFullName (Fname, Lname));

    }

    public static String ufnFullName (String Fname, String Lname) {

    String FullName = Fname+" "+Lname;

    return FullName;

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Create and test a user-defined function named ufnFullName that combines the values of the two parameters named FirstName and LastName into ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers