Well it should do - unless you have another method called Main, that isn't in that class?
So start by checking if it executes that Main method: put a breakpoint on the first line, and run your app in the debugger. If it hits the breakpoint, your app will stop and wait for you. Step though until you do (or don't) get into the GetData method.
As Dudi suggested, it doesn't compile, because of the parameter problems.
You can fix that, it's not complex:
static void Main()
{
int orderNum, quantity;
double total;
const double PRICE_EACH = 3.99;
GetData(out orderNum, out quantity);
total = quantity * PRICE_EACH;
Console.WriteLine(" Order #{0}, Quantity ordered = {0}",
orderNum, quantity);
Console.WriteLine("Total is {0}", total.ToString("C"));
}
private static void GetData(out int orderNum, out int quantity)
{
String s1, s2;
Console.Write("Enter order number ");
s1 = Console.ReadLine();
Console.Write("Enter quantity ");
s2 = Console.ReadLine();
orderNum = Convert.ToInt32(s1);
quantity = Convert.ToInt32(s2);
}
But the code that results, is a bit...um...poor.
Instead, try doing this:
const double PRICE_EACH = 3.99;
static void Main()
{
int orderNum = GetValue("Enter Order number : ");
int quantity = GetValue("Enter Quantity : ");
double total = quantity * PRICE_EACH;
Console.WriteLine("Order #{0}, Quantity ordered = {0}", orderNum, quantity);
Console.WriteLine("Total is {0}", total.ToString("C"));
}
private static int GetValue(string prompt)
{
int value;
do
{
Console.Write(prompt);
} while (!int.TryParse(Console.ReadLine(), out value));
return value;
}
This doesn't crash if the user enters a "bad" value - it prompts him and gets it again.
It also uses a method in a more "normal" way - to return the value you are interested in.
Try it. See what happens.