none
It's a task for school with C# RRS feed

  • Question

  • Hey Everyone,

    I have a simple question. For school I have to make a little program with some names and dates and a random number.

    Here you can find the question of the excecise:

    In this exercise, they have to put there the first name, family name and the date of birth. You create a code based on these data. the code starts with 2 letters of the first name in capital letters and then a number between 1 and 10, followed by the last two letters of the first name in lower case with the date of birth without delimiters.

    thanks guys!


    • Edited by MR.BUZZ88 Sunday, September 16, 2018 1:10 PM
    Sunday, September 16, 2018 1:08 PM

All replies

  • >I have a simple question. 

    Yes, I have read a specification of this task and find it very simple.

    I would say that you should be able to complete it within hour or two.

    Good luck with your home work!

    or as some guys from the prison use to say: early in - early out.


    Sincerely, Highly skilled coding monkey.

    Sunday, September 16, 2018 4:27 PM

  • I have a simple question. For school I have to make a little program with some names and dates and a random number.

    Here you can find the question of the excecise:


    I don't see any question in your post. Just a task description.

    We don't do homework assignments for students here.

    Show us the code *you* have written so far.

    Describe precisely which part of the program you are stuck on.

    Then we can make suggestions to guide you toward a resolution without
    actually doing your work for you.

    - Wayne

    Sunday, September 16, 2018 5:15 PM
  • Hi MR.BUZZ88,

    I would suggest that you could write your  home work by yourself, maybe the following code could provide some ideas for you.

    class Program
        {
            static void Main(string[] args)
            {
                List<MyClass> list = new List<MyClass>()
                {
                    new MyClass(){ FirstName = "Test1", FamilyName = "Test1", BirthDate = new DateTime(2008, 3, 1)},
                    new MyClass(){ FirstName = "Test2", FamilyName = "Test2", BirthDate = new DateTime(2008, 3, 1)},
                    new MyClass(){ FirstName = "Test3", FamilyName = "Test3", BirthDate = new DateTime(2008, 3, 1)},
                    new MyClass(){ FirstName = "Test4", FamilyName = "Test4", BirthDate = new DateTime(2008, 3, 1)},
                    new MyClass(){ FirstName = "Test5", FamilyName = "Test5", BirthDate = new DateTime(2008, 3, 1)}
                };
    
                Random rnd = new Random();
    
                var result = list.Select(t => string.Format("{0}{1}{2}{3}",t.FirstName.Substring(0, 2).ToUpper(), rnd.Next(1,10), t.FirstName.Substring(t.FirstName.Length-2, 2).ToLower(), t.BirthDate.ToString("MMddyyyy"))).ToList();
            }
        }
    
        public class MyClass
        {
            public string FirstName { get; set; }
            public string FamilyName { get; set; }
            public DateTime BirthDate { get; set; }
        }

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, September 18, 2018 1:26 AM
    Moderator
  • Well, seriously I think the code he need to know has already been taught in lessons. If he still not understand, it's better to get him ask the teacher and let the teacher knows, so the teacher have a chance to correct it before he graduates (or before "he proceed to a more advanced subject so the accumulated "knowledge not learnt" debt is too huge to do anything about it").

    At least he have to learn "how to ask a specific question for help" and you should give him the chance to ask that question.



    Tuesday, September 18, 2018 1:50 AM
    Answerer