Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The instructions are to create a Method named Display in the shirtDemo class tha

ID: 3670023 • Letter: T

Question

The instructions are to create a Method named Display in the shirtDemo class that takes a variable number of arguments using a parameter array.

   Loop through the parameter array displaying the properties from each shirt object in the array.

Call the Display method a few times using a different number of shirt objects each time to verify that the method handles them properly.

using System;

namespace ShirtDemo
{
    class Program
    {

        public string material { get; set; }
        public string color { get; set; }
        public string size { get; set; }

        static void Main(string[] args)
        {
          

            Shirt[] array1 = new Shirt[3];
            array1[0] = new Shirt("Cotton", "pink", "small");
            array1[1] = new Shirt("Polyester", "red", "medium");
            array1[2] = new Shirt("Silk", "blue", "large");

        
        }

        private static void DisplayStrings(Shirt[] array1)
        {
        
        }

        // params array method
        public static void DisplayString(params Shirt[] array)
        {
            foreach (Shirt x in array)
            {
                Console.WriteLine("Material is:" + x.material);
                Console.WriteLine("Color is:" + x.color);
                Console.WriteLine("Size is:" + x.size);
                Console.WriteLine("---------------------------------------");
            }
        }
    }
}


its telling me that the namespace ShirtDemo already contains a definition for Shirt???

Explanation / Answer

Change the namespace of class where you have defined Shirt class. I this it will work.

Else you post your Shirt class defination here.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote