public static void Main()
int order, number, cost = 0, x, re;
Console.WriteLine("---Vending Machine---");
Console.WriteLine("=====================");
Console.WriteLine("Our menu..." );
string[] menu = { "1. Bamboo drink", "2. Max energy drink", "3. Super soda", "4. Minton tea", "5. Arabica", "6. Fresh friut", "7. Aurora"};
foreach(string i in menu )
Console.WriteLine("{0} ",i);
Console.WriteLine("=====================");
Console.Write("Select your order : ");
order = int.Parse(Console.ReadLine());
Console.WriteLine("- - - - - - - - - - - - - - - - - - - - -");
Console.WriteLine("Your oder is : Bamboo drink");
Console.WriteLine("How many ? ");
Console.Write("You order : ");
number = int.Parse(Console.ReadLine());
Console.WriteLine("You get : {0} Bamboo drink", number);
Console.WriteLine("- - - - - - - - - - - - - - - - - - - - -");
Console.WriteLine("You should pay: "+ cost + " bath");
Console.WriteLine("- - - - - - - - - - - - - - - - - - - - -");
Console.WriteLine("Your order is : Max energy drink");
Console.WriteLine("How many ? ");
Console.Write("You order : ");
number = int.Parse(Console.ReadLine());
Console.WriteLine("You get : {0} Max energy drink", number);
Console.WriteLine("- - - - - - - - - - - - - - - - - - - - -");
Console.WriteLine("You should pay: "+ cost + " bath");
Console.WriteLine("- - - - - - - - - - - - - - - - - - - - -");
Console.WriteLine("Your order is : Super Soda");
Console.WriteLine("How many ? ");
Console.Write("You order : ");
number = int.Parse(Console.ReadLine());
Console.WriteLine("You get : {0} Super Soda", number);
Console.WriteLine("You should pay: "+ cost + " bath");
Console.WriteLine("- - - - - - - - - - - - - - - - - - - - -");
Console.WriteLine("- - - - - - - - - - - - - - - - - - - - -");
Console.WriteLine("Your order is : Minton tea");
Console.WriteLine("How many ? ");
Console.Write("You order : ");
number = int.Parse(Console.ReadLine());
Console.WriteLine("You get : {0} Minton tea", number);
Console.WriteLine("You should pay: "+ cost + " bath");
Console.WriteLine("- - - - - - - - - - - - - - - - - - - - -");
Console.WriteLine("- - - - - - - - - - - - - - - - - - - - -");
Console.WriteLine("Your order is : Arabica");
Console.WriteLine("How many ? ");
Console.Write("You order : ");
number = int.Parse(Console.ReadLine());
Console.WriteLine("You get : {0} Arabica", number);
Console.WriteLine("You should pay: "+ cost + " bath");
Console.WriteLine("- - - - - - - - - - - - - - - - - - - - -");
Console.WriteLine("- - - - - - - - - - - - - - - - - - - - -");
Console.WriteLine("Your order is : Fresh fruit");
Console.WriteLine("How many ? ");
Console.Write("You order : ");
number = int.Parse(Console.ReadLine());
Console.WriteLine("You get : {0} Fresh fruit",number);
Console.WriteLine("You should pay: "+ cost + " bath");
Console.WriteLine("- - - - - - - - - - - - - - - - - - - - -");
Console.WriteLine("- - - - - - - - - - - - - - - - - - - - -");
Console.WriteLine("Your order is : Aurora");
Console.WriteLine("How many ? ");
Console.Write("You order : ");
number = int.Parse(Console.ReadLine());
Console.WriteLine("You get : {0} Aurora",number);
Console.WriteLine("You should pay: "+ cost + " bath");
Console.WriteLine("- - - - - - - - - - - - - - - - - - - - -");
Console.WriteLine("- - - - - - - - - - - - - - - - - - - - -");
Console.WriteLine( "Select only 1 - 7" );
Console.WriteLine("\n ");
Console.WriteLine("- - - - - - - - - - - - - - - - - - - - -");
Console.WriteLine("- - - - - - - - - - - - - - - - - - - - -");
Console.WriteLine("Enter the money : ") ;
x=int.Parse(Console.ReadLine());
Console.WriteLine("- - - - - - - - - - - - - - - - - - - - -");
case 1: Console.WriteLine("Your oder is : Bamboo drink");
Console.WriteLine("You pay: "+ "{0}",x + " bath");
case 2:Console.WriteLine("Your order is : Max energy drink");
Console.WriteLine("You pay: "+ "{0}",x + " bath");
case 3:Console.WriteLine("Your order is : Super Soda");
Console.WriteLine("You pay: "+ "{0}",x + " bath");
case 4:Console.WriteLine("Your order is : Minton tea");
Console.WriteLine("You pay: "+ "{0}",x + " bath");
case 5:Console.WriteLine("Your order is : Arabica");
Console.WriteLine("You pay: "+ "{0}",x + " bath");
case 6:Console.WriteLine("Your order is : Fresh fruit");
Console.WriteLine("You pay: "+ "{0}",x + " bath");
case 7:Console.WriteLine("Your order is : Aurora");
Console.WriteLine("You pay: "+ "{0}",x + " bath");
default: Console.WriteLine("Select only 1-7");
Console.WriteLine("- - - - - - - - - - - - - - - - - - - - -");
Console.WriteLine("You get change for {0} baht ", Withdrawal);
Console.Write("You receive total change of "+"{0}", Withdrawal + " with ");
if (Withdrawal >0 && x>cost)
Console.WriteLine("You get change for {0} Baht.", Withdrawal);
if (Withdrawal >=1000 && x>cost)
Console.Write(" {0} thousand note ", Withdrawal/1000);
if(Withdrawal % 1000 >=500 && x>cost)
Console.WriteLine(" {0} five hundred note ", Withdrawal % 1000 / 500);
if (Withdrawal % 1000 % 500 >=100 && x>cost)
Console.WriteLine(" {0} hundred note ", Withdrawal % 1000 % 500 / 100);
if (Withdrawal % 1000 % 500 % 100 >= 50 && x>cost)
Console.WriteLine(" {0} fivety note ", Withdrawal % 1000 % 500 % 100 / 50);
if (Withdrawal % 1000 % 500 % 100 % 50 >= 20 && x>cost)
Console.WriteLine(" {0} twenty note ", Withdrawal % 1000 % 500 % 100 % 50 / 20);
if (Withdrawal % 1000 % 500 % 100 % 50 % 20 >=10 && x>cost)
Console.WriteLine(" {0} ten coin ",Withdrawal % 1000 % 500 % 100 % 50 % 20 / 10 );
if (Withdrawal % 1000 % 500 % 100 % 50 % 20 % 10 >=5 && x>cost)
Console.WriteLine(" {0} five coin ",Withdrawal % 1000 % 500 % 100 % 50 % 20 % 10 / 5);
if (Withdrawal % 1000 % 500 % 100 % 50 % 20 % 10 % 5 >= 2 && x>cost)
Console.WriteLine(" {0} two coin ",Withdrawal % 1000 % 500 % 100 % 50 % 20 % 10 % 5 /2);
if (Withdrawal% 100 % 50 % 20 % 10 % 5 >= 1 && x>cost)
Console.WriteLine(" {0} one coin ",Withdrawal % 1000 % 500 % 100 % 50 % 20 % 10 % 5 % 2 /1);
Console.WriteLine("Your money is not enough. ");
Console.WriteLine(" You receive no change. ");
Console.WriteLine("=====================");
Console.WriteLine("Do you want to order some else ? If want please enter 1 or on please enter 2");
re = int.Parse(Console.ReadLine());
Console.WriteLine("Continue order....");
Console.WriteLine("Thank you for paying");
Console.WriteLine("Please press 1 or 2");