I have an array in class array and I'd like to access it's members in class table. I'm lost on how to do this. Any help would be greatly appreciated, thanks.
using System;
public class Restaurant
{
//Writes a welcome message.
public void Welcome()
{//start Welcome method
Console.WriteLine("Welcome to Qdoba!\n");
}//end Welcome method
public class array //can't access these in the table class
{
int[][] table = new int[8][];
table[0] = new int[] { 0, 1, 2, 3, 4, 5, 6, 7 };
table[1] = new int[] { 0, item.Chips, item.Queso, item.Guacamole };
table[2] = new int[] { 0, item.Chips, item.Queso, item.Guacamole };
table[3] = new int[] { 0, item.Chips, item.Queso, item.Guacamole };
table[4] = new int[] { 0, item.Chips, item.Queso, item.Guacamole };
table[5] = new int[] { 0, item.Chips, item.Queso, item.Guacamole };
table[6] = new int[] { 0, item.Chips, item.Queso, item.Guacamole };
table[7] = new int[] { 0, item.Chips, item.Queso, item.Guacamole };
}
public class Table
{
public void tables()
{
Items item = new Items();
Menu menu = new Menu();
int orderMore = 0;
do
{
Console.WriteLine("What is your table number? (1-7)");
int tables = Convert.ToInt32(Console.ReadLine());
Console.WriteLine();
if (tables == 1)
{
menu.menu();
Console.WriteLine("What would you like to order?");
int order = Convert.ToInt32(Console.ReadLine());
++table[1][order];
Console.WriteLine(table[1][order]);
Console.WriteLine("Would you like to order anything else? Type '1' to order more, '0' to stop.");
orderMore = Convert.ToInt32(Console.ReadLine());
}
if (tables == 2)
{
Console.WriteLine("What would you like to order?");
int order = Convert.ToInt32(Console.ReadLine());
++table[2][order];
Console.WriteLine(table[2][order]);
Console.WriteLine("Would you like to order anything else? Type '1' to order more, '0' to stop.");
orderMore = Convert.ToInt32(Console.ReadLine());
}
}
while (orderMore != 0);
}
}
public class Menu
{
public void menu()
{
Items i = new Items();
double[] price = { i.ChipsPrice, i.QuesoPrice, i.GuacamolePrice, i.ChickenBurritoPrice, i.SteakBurritoPrice,
i.PestoBurritoPrice, i.PorkBurritoPrice, i.QuesadillaPrice, i.SodaPrice, i.TeaPrice, i.SnapplePrice};
string[] items = { "Chips\t\t", "Queso\t\t", "Guacamole\t\t", "Chicken Burrito\t", "Steak Burrito\t", "Pesto Burrito\t",
"Pork Burrito\t\t", "Quesadilla\t\t", "Soda\t\t\t", "Tea\t\t\t", "Snapple\t\t"};
int[] number = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
for (int j = 0; j < number.Length; j++)
{//start for
Console.WriteLine("{0}) {1} {2:C}", number[j], items[j], price[j]);
}//end for
Console.WriteLine();
}
}
public class Items
{
//appetizers
public int Chips = 77;
public double ChipsPrice = 1.99;
public int Queso = 0;
public double QuesoPrice = 2.49;
public int Guacamole = 0;
public double GuacamolePrice = 2.99;
//entrees
public int ChickenBurrito = 0;
public double ChickenBurritoPrice = 5.99;
public int SteakBurrito = 0;
public double SteakBurritoPrice = 6.49;
public int PestoBurrito = 0;
public double PestoBurritoPrice = 5.99;
public int PorkBurrito = 0;
public double PorkBurritoPrice = 6.49;
public int Quesadilla = 0;
public double QuesadillaPrice = 4.99;
//drinks
public int Soda = 0;
public double SodaPrice = .99;
public int Tea = 0;
public double TeaPrice = 1.19;
public int Snapple = 0;
public double SnapplePrice = 1.49;
}
public class Order
{
public void order()
{
Console.WriteLine("To start a new tab type 1. To add to a tab type 2. To close a tab type 3.");
string tab = Console.ReadLine();
Console.WriteLine();
Table t = new Table();
//start a new tab
if (tab == "1")
{//start if
t.tables();
Console.WriteLine();
order();
}//end if
if (tab == "2")
{//start if
t.tables();
Console.WriteLine();
Console.WriteLine("\nIs the table ready for the check? If yes, type 1. If no, type 2.");
string addTab = Console.ReadLine();
if (addTab == "1")
{//start if
tab = "0";
// Bill();
}//end if
if (addTab == "2")
{//start if
tab = "0";
order();
}//end if
}//end if
}
}
}
public class Driver : Restaurant
{
public static void Main()
{
Restaurant r = new Restaurant();
r.Welcome();
Order o = new Order();
o.order();
}
}