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 static System.Console; using System; using System.Collections.Generic; using System.Linq; using System.Text; class ShirtDemo { static void Main(String[] args) { Shirt shirt = new Shirt("cotton", "white", "L"); Console.WriteLine("{0,-12}{1,10}{2,10}", "Material", "Color", "Size"); Display(shirt); shirt = new Shirt("cotton", "blue", "XL"); Display(shirt); shirt = new Shirt("polyester", "pink", "M"); Display(shirt); Console.WriteLine();

Console.WriteLine("{0,-12}{1,10}{2,10}", "Material", "Color", "Size"); shirt = new Shirt("cotton", "white", "L"); Display(shirt); shirt = new Shirt("cotton", "blue", "XL"); Display(shirt); shirt = new Shirt("polyester", "pink", "M"); Display(shirt); shirt = new Shirt("silk", "yellow", "S"); Display(shirt);

Console.WriteLine();

Console.WriteLine("{0,-12}{1,10}{2,10}", "Material", "Color", "Size"); shirt = new Shirt("cotton", "white", "L"); Display(shirt); shirt = new Shirt("cotton", "blue", "XL"); Display(shirt); shirt = new Shirt("polyester", "pink", "M"); Display(shirt); shirt = new Shirt("silk", "yellow", "S"); Display(shirt); shirt = new Shirt("silk", "white", "XXL"); Display(shirt);

Console.ReadKey(); } class Shirt { public string Material { get; set; } public string Color { get; set; } public string Size { get; set; }

public Shirt() { Material = ""; Color = ""; Size = ""; } public Shirt(string material, string color, string size) { this.Material = material; this.Color = color; this.Size = size; } } public static void Display(Shirt shirt) { Console.WriteLine("{0,12}{1,10}{2,10}", shirt.Material, shirt.Color, shirt.Size); }

}

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions

Question

What sort of information do senior managers want?

Answered: 1 week ago

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago