A sweatshirt manufacturer wants to take inventory of the college logo sweat- shirts that it has in stock. The company makes sweatshirts for seven colleges. Refer to the colleges by number, 1–7. Sweatshirts come in four sizes: small, medi- um, large, and x-large. An employee gathers the inventory information by hand. Write a program that prompts the employee to enter the number of sweatshirts in stock for each of the seven colleges in each of the four sizes. Store the inventory information in a two-dimensional array. After inputting the inventory data, the program should display an inventory report in the following format.
1
Expert's answer
2016-04-01T11:01:04-0400
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace sizes { class Program { static void Main(string[] args) { int[,] array = new int[7, 4]; for (int i = 0; i < 7; i++) { for (int j = 0; j < 4; j++) { if (j == 0) { Console.WriteLine("Enter number for "+ (i+1)+" stock (size: small):"); array[i, j] = Convert.ToInt32(Console.ReadLine()); } if (j == 1) { Console.WriteLine("Enter number for " + (i + 1) + " stock (size: medium):"); array[i, j] = Convert.ToInt32(Console.ReadLine()); } if (j == 2) { Console.WriteLine("Enter number for " + (i + 1) + " stock (size: latge):"); array[i, j] = Convert.ToInt32(Console.ReadLine()); } if (j == 3) { Console.WriteLine("Enter number for " + (i + 1) + " stock (size x-large):"); array[i, j] = Convert.ToInt32(Console.ReadLine()); } } } Console.WriteLine("____________________________________________________________________\n"); for (int i = 0; i < 7; i++) { for (int j = 0; j < 4; j++) { Console.Write(array[i, j]+" "); } Console.WriteLine(); } Console.ReadLine();
Comments
Leave a comment