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.

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

What I got :

using System;

class Shirt

{

public string Material { get; set; }

public string Color { get; set; }

public string Size { get; set; }

public Shirt(string material, string color, string size)

{

Material = material;

Color = color;

Size = size;

}

}

class ShirtDemo

{

static void Main(string[] args)

{

Shirt shirt1 = new Shirt("cotton", "white", "L");

Shirt shirt2 = new Shirt("polyester", "blue", "M");

Shirt shirt3 = new Shirt("silk", "black", "S");

Display(shirt1, shirt2, shirt3);

Console.ReadKey();

}

static void Display(params Shirt[] shirts)

{

foreach (Shirt shirt in shirts)

{

Console.WriteLine("Material: {0}, Color: {1}, Size: {2}", shirt.Material, shirt.Color, shirt.Size);

}

}

}

When I run it.

Thank you.

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

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

More Books

Students also viewed these Databases questions