Answered Creating a Console Application in VB

  • Tuesday, May 15, 2012 6:10 PM
     
     
    Please, I would like to know how to create a console application that asks the user to input his or her first name and last name separately. The console application will display a message that varies according to the user. Then combine the two names into a single string variable named fullName, so that they 'll output a full name. Thank you.

All Replies

  • Tuesday, May 15, 2012 6:13 PM
     
     
    sounds straight forward enough (and like homework). where are you having a problem? We won't write it for you, but we can help where you have trouble.
  • Tuesday, May 15, 2012 6:27 PM
     
     

    Hello Fredmord,

    Please, I would like to know how to create a console application that asks the user to input his or her first name and last name separately. The console application will display a message that varies according to the user. Then combine the two names into a single string variable named fullName, so that they 'll output a full name. Thank you.

    We are happy to help, but you should explain that difficulties are created in the application, we also scivere the sample code, but this does not help calling out what you do and why you do, so if we have trouble explaining where glad to help :)

    Best Regards.


  • Wednesday, May 16, 2012 7:25 PM
     
     Answered

    1. ask user for first name

    2. ask user for last name

    3. combine first & last names

    4. see if the name matches a pre-defined name, if so show a custom message, if not - show a generic message

    You will be using Console.WriteLine to display text, Console.WriteLine to get user input

  • Wednesday, May 16, 2012 8:09 PM
     
     Answered

    Console.Write("First name? ")

    Dim firstname as string = Console.ReadLine

    'Repeat the above steps for last name

    'Combine the names

    Dim fullname as string = firstname & " " & lastname

    'Display the full name

    Console.WriteLine("Your full name is: " & fullname)