1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
liraira [26]
3 years ago
13

Create an application named ShirtDemo that declares several Shirt objects and includes a display method to which you can pass di

fferent 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).
Computers and Technology
1 answer:
kvv77 [185]3 years ago
4 0

Answer:

//Shirt.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace ShirtApplication

{

   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;

       }

   }

}

//Program.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace ShirtApplication

{

   class Program

   {

       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");

           //Create an instance of Shirt

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

           //call display method

           display(shirt);

           //Create an instance of Shirt

           shirt = new Shirt("cotton", "blue", "XL");

           //call display method

           display(shirt);

           shirt = new Shirt("polyester", "pink", "M");

           //call display method

           display(shirt);

           //Create an instance of Shirt

           shirt = new Shirt("silk", "yellow", "S");

           display(shirt);

           shirt = new Shirt("silk", "white", "XXL");

           //call display method

           display(shirt);

           Console.ReadKey();

       }        

       public static void display(Shirt shirt)

       {

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

       }

   }

}

Explanation:

  • In the program.cs file, create an instance of Shirt .
  • Call the display method  with relevant values.
  • Define a method to display that takes Shirt object and prints the properties of shirt object to console .
You might be interested in
What have been three technological changes to photography in the past 200 years?
kolbaska11 [484]
I hope this helps but cars, phones and computers.
3 0
3 years ago
Suppose we have two String objects and treat the characters in each string from beginning to end in the following way: With one
Simora [160]

Answer:

If all the character pairs match after processing both strings, one string in stack and the other in queue, then this means one string is the reverse of the other.                            

Explanation:

Lets take an example of two strings abc and cba which are reverse of each  other.

string1 = abc

string2 = cba

Now push the characters of string1 in stack. Stack is a LIFO (last in first out) data structure which means the character pushed in the last in stack is popped first.

Push abc each character on a stack in the following order.

c

b

a

Now add each character of string2 in queue. Queue is a FIFO (first in first out) data structure which means the character inserted first is removed first.

Insert cba each character on a stack in the following order.

a   b   c

First c is added to queue then b and then a.

Now lets pop one character from the stack and remove one character from queue and compare each pair of characters of both the strings to each other.

First from stack c is popped as per LIFO and c is removed from queue as per FIFO. Then these two characters are compared. They both match

c=c. Next b is popped from stack and b is removed from queue and these characters match too. At the end a is popped from the stack and a is removed from queue and they both are compared. They too match which shows that string1 and string2 which are reverse of each other are matched.

6 0
3 years ago
Distinguish<br> between formal and Informal<br> Information System<br> Information systems
Harlamova29_29 [7]

Explanation:

Formal; A formal information system is based on

the organization represented by the organization chart.

Informal; The informal information system is

employee based system designed

to meet personal and vocational needs

and to help in solution of work-related problems.

5 0
2 years ago
Which of the following would be the most appropriate way to define a method that calculates and returns the final price, after t
Oksanka [162]

D. I hope it helped
5 0
3 years ago
30 mins and I will give Brianlest what is the difference between a method and a function in which ways are they similar why do y
omeli [17]

Answer:

For 1), you should also add that methods in C++ are called member functions. Thus, the difference between functions and methods in this context is analogous to the difference between functions and member functions in C++. Furthermore, languages like Java only have methods. In this case, functions would be analogous to static methods and methods would have the same meaning. For 2), you should add that a method is able to operate on the private instance (member) data declared as part of the class. Any code can access public instance data.   A function is a mathematical construct. I would say all methods are functions but not all functions are methods

Explanation:

8 0
3 years ago
Other questions:
  • What is master slide and tell about master slide
    6·1 answer
  • Create a program that includes a function called toUpperCamelCase that takes a string (consisting of lowercase words and spaces)
    9·1 answer
  • Careers in information technology deal with
    12·2 answers
  • What single awk command can be used to display all the login names and their associated numerical user IDs
    14·1 answer
  • In what situations might you need to use a function that calls another function?
    11·1 answer
  • The LCD screens are found in​
    14·1 answer
  • Jasmine plays a game on her computer screen. A moving balloon appears on the screen, and she has to pop the balloon by clicking
    10·1 answer
  • Help? Can you explain what this mean?
    7·1 answer
  • write an assembly program that uses the output compare function of a timer to toggle an led every second
    6·1 answer
  • Explain in detail, how the Depth Wavelet Transform (DWT) algorithm works, specifically with respect to EEGs (a non-invasive brai
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!