I need help with a practice problem. Create an application in C# named ShirtDemo
ID: 3676195 • Letter: I
Question
I need help with a practice problem.
Create an application in C# 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.
Output:
Material Color Size
cotton white L
polyester pink XL
-------------------------------
Material Color Size
cotton white L
cotton blue XL
polyester pink M
silk yellow S
Material Color Size
------------------------------
cotton white L
cotton blue XL
polyester pink M
silk yellow S
silk white XXL
Explanation / Answer
shirtdemo describes material,color and size shirtDemo material color size public class ShirtDemo { public int shirtID = 0; // Default ID for the shirt public String description = "-description required-"; // default // The color codes are R=Red, B=Blue, G=Green, U=Unset public char colorCode = 'U'; public double size = 0.0; // Default price for all shirts // This method displays the values for an item public void displayInformation() { System.out.println("Shirt ID: " + shirtID); System.out.println("Shirt description:" + description); System.out.println("Color Code: " + color); System.out.println("Shirt size: " + size); System.out.println("Quantity in stock: " + quantityInStock); } // end of display method } // end of class
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.