Question: Create an application named ShirtDemo that declares several Shirt objects and includes a display method to which you can pass different numbers of Shirt objects

Create an application named ShirtDemo that declares several Shirt objects and includes a display method to which you can pass different numbers of Shirt objects in successive method calls. I need to be sure it has a "Shirt" class and a "Display" method.

The Shirt class contains auto-implemented properties for a Material, Color, and Size (all of type string).

This is what I have right now:

using System; namespace ShirtDemo { class Shirt {

public string Material { get; set; } public string Color { get; set; } public string Size { get; set; } public Shirt(string material, string color, int size) { this.Material = matireal; this.Color = color; this.Size = size; } } Class Program { static void Main(string[] args) { Shirt s1, s2,s3,s4; s1 = new Shirt("Cotton","Black",46); s2 = new Shirt("Wool", "White", 44); s3 = new Shirt("Wool", "White", 42); s4 = new Shirt ("Cotswool", "Blue", 44); Console.WriteLine("Using one parameter for" + "method call: "); displayShirt(s1); Console.WriteLine("Using three parameters for" + "method call: "); displayShirt(s2,s3,s4); Console.ReadKey(); } static void displayShirt(params Shirt[] shirts) { int counter = 0; foreach (Shirt shirt in shirts) { Console.WriteLine("Shirt number" + ++counter); Console.WriteLine("Material:" + shirt.Material); Console.WriteLine("Color:" + shirt.Color); Console.WriteLine("Size:" + shirt.Size); Console.WriteLine(); } } } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!