Program deptstore.cs
Demonstrates use of a two-dimensional array
using System;
namespace DepartmentStore
{
class Program
{
static void Main(string[] args)
{
// The first list in ItemNumber contains women's items
// The other contains non-women items
long[,] ItemNumber = new long[2, 3]{
{ 947783, 934687, 973947 },
{ 739579, 367583, 743937 }
};
string[,] ItemName = new string[2, 3]
{
{
"Women Double-faced wool coat",
"Women Floral Silk Tank Blouse",
"Women Push Up Bra"
},
{
"Men Cotton Polo Shirt",
"Children Cable-knit Sweater ",
"Children Bear Coverall Cotton"
}
};
decimal[,] UnitPrice = new decimal[2, 3]
{
{ 275.25M, 180.05M, 50.00M },
{ 45.55M, 25.65M, 28.25M }
};
for(int i=0; i<2; i++){
for(int j=0; j<3; j++){
Console.WriteLine("Receipt:");
Console.WriteLine("\tItem Number: {0}", ItemNumber[i,j].ToString());
Console.WriteLine("\tDescription: {0}", ItemName[i,j]);
Console.WriteLine("\tUnit Price: {0:C}\n", UnitPrice[i,j].ToString());
}
}
Console.Write("\n\tPress the Enter key to quit program... ");
Console.ReadLine();
}
}
}