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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started