Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Machine Performance Modeling Methodologies And Evaluation Strategies Lncs 257

Authors: Francesca Cesarini ,Silvio Salza

1st Edition

3540179429, 978-3540179429

More Books

Students also viewed these Databases questions

Question

Identify cultural barriers to communication.

Answered: 1 week ago