Answer to Question #340845 in C# for Julie

Question #340845

Using Visual Studio, create a Console App that:


a. Has a class to encapsulate the following data about a bird:


1.


. English name


i. Latin name


ii. Date last sighted


a. Allows the user to enter the information for a bird;


b. Stores the information in a Bird object; and


c. Displays the information to the user.



1
Expert's answer
2022-05-14T16:39:28-0400
internal class Program
    {
        class Bird
        {
            public string EnglishName { get; set; }
            public string LatinName { get; set; }
            public DateTime DateLastSighted { get; set; }


            public override string ToString()
            {
                return $"English name {EnglishName}, Latin name {LatinName}, Date last sighted {DateLastSighted.ToShortDateString()}";
            }
        }


        static void Main(string[] args)
        {
            Bird bird = new Bird();
            Console.Write("Enter the English name of the bird: ");
            bird.EnglishName = Console.ReadLine();
            Console.Write("Enter the Latin name of the bird: ");
            bird.LatinName = Console.ReadLine();
            Console.Write("Enter the Date last sighted name of the bird: ");
            bird.DateLastSighted = DateTime.Parse(Console.ReadLine());
            Console.WriteLine(bird);
            Console.ReadKey();
        }      
    }

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS