Write the pseudocode for a function named getFirstName that asks the user to enter his or her first name, and returns it. Write the main module that declares a variable called name, calls getFirstName (setting its return value into name), and displays that name with a user-friendly message.

Respuesta :

Answer:

Function getFirstName(nameInput)

  Declare nameInput

  Display "Please enter your first name."

  Input nameInput

  Return nameInput

End function

Module main()

  Declare name

  Call getFirstName(name)

  Display "Hi + 'name'!"

End module

Explanation:

First, we define the function getFirstName(nameInput) that has the parameter nameInput to get the input name a retrieve it to the module main. Then, we define the module main that declares the variable name, calls and retrieves the name variable of the function previously defined.