Question #58797

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.
Inventory Report College
1 2 3 4 5 6 7 Total
Size
Small Medium
Large
XLarge
College Total Total Quantity On Hand
At the end of each row should be the total inventory for that size. At the bottom of each column should be total inventory of each college. The Total Quantity On Hand should be the total inventory of all sweatshirts.
1

Expert's answer

2016-04-04T12:28:04-0400

Answer on Question #58797 – Programming & Computer Science | C#

Question:

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, medium, 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.

Inventory Report College

1 2 3 4 5 6 7 Total

Size

Small Medium

Large

XLarge

College Total Total Quantity On Hand

At the end of each row should be the total inventory for that size. At the bottom of each column should be total inventory of each college. The Total Quantity On Hand should be the total inventory of all sweatshirts.

Answer:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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: large):");
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\n");
Console.WriteLine(" \t 1 \t 2 \t 3 \t 4 \t 5 \t 6 \t 7 \t Total");
int totalsize = 0;
for (int i = 0; i < 4; i++)
{
switch (i)
{
case 0:
Console.Write("Small ");
break;
case 1:
Console.Write("Medium ");
break;
case 2:
Console.Write("Large ");
break;
case 3:
Console.Write("XLarge ");
break;
}
for (int j = 0; j < 7; j++)
{
Console.Write(array[j, i]+" \t ");
totalsize += array[j, i];
}
Console.Write(totalsize + "\n");
totalsize = 0;
}
Console.Write("Total ");
int totalcol = 0;
for (int i = 0; i < 7; i++)
{
for (int j = 0; j < 4; j++)
{
totalcol += array[i, j];
}
Console.Write(totalcol + "\t ");
totalcol = 0;
}
Console.ReadLine();
}
}


https://www.AssignmentExpert.com

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS