C# coding help barely starting off!

I am probably way ahead of myself but I need help. I want the input to be show back to the user. I am not sure if it is being set to the property correctly or what… Can someone help me edit my code or make a suggestion…

using System;

namespace BookMe
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("BookMeDetailer - an app for detailers and those looking for one!\n");

            //calls methods to enter user data
             GetUserData getData = new GetUserData();

     
            //Prints User Data
            PrintUserData showData = new PrintUserData();

            showData.printData();


            Console.ReadLine();

        }
    }
} 

second page

using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;

namespace BookMe
{
    class GetUserData
    {

        static string UserFirstName()
        {
            Console.WriteLine("Enter First Name: ");
            string userFirstName = Console.ReadLine();

            return userFirstName;
        }

        static string UserLastName()
        {
            Console.WriteLine("Enter Last Name: ");
            string userLastName = Console.ReadLine();

            return userLastName;
        }

        static string UserPhoneNumber()
        {
            Console.WriteLine("Enter Phone #: ");
            string userPhoneNumber = Console.ReadLine();


            return userPhoneNumber;
        }


        UserData copy = new UserData
        {
            FirstName = UserFirstName(),
            LastName = UserLastName(),
            PhoneNumber = UserPhoneNumber()
        };
    }

}

third page

using System;
using System.Collections.Generic;
using System.Text;

namespace BookMe
{
    class PrintUserData
    {
        public void printData()
        {
            UserData getData = new UserData();
            string fName = getData.FirstName;
            string lName = getData.LastName;
            string PhoneNum = getData.PhoneNumber;

            Console.WriteLine("\n Please review your information\n\n");
            Console.WriteLine("First Name: {0} \nLast Name: {0} \nPhone #: {0}", fName, lName, PhoneNum );

        }
    }
}

last pageusing System;
using System.Collections.Generic;
using System.Text;

namespace BookMe
{
    class UserData
    {
        private string  _firstName;
        private string _lastName;
        private string _phoneNumber;
 
        // property 

        public string FirstName
        {
            get {return this._firstName; }
            set { this._firstName = value; }

        }

        public string LastName
        {
            get { return _lastName; }
            set { _lastName = value; }
        }

        public string PhoneNumber
        {
            get { return _phoneNumber; }
            set { _phoneNumber = value; }
        }

    }
}



Hello there,

For future posts, please do not post screenshots of code. This is very difficult to work with, and you are much less likely to get help.

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

sorry about that! great tool! I just updated my post. Thank you :slight_smile:

1 Like