Did you delete your Main() method?
I have reformatted the code and removed two lines.
I did not add any functionality or correct anything other than making a Main() and making the methods static and removing the Console.ReadLine() calls that are causing you to need to press enter:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class WasteSchedul
{
public static void WriteMenuText()
{
Console.WriteLine("\n1 Bin 1");
Console.WriteLine("2 Bin 2 ");
Console.WriteLine("0 Exit the program");
Console.Write("\nYour choice ");
}
private static void Bin1()
{
int count = 52;
int p = 0;
const int cols = 3;
string montera = "";
for (int i = 1; i <= count; i += 2)
{
montera += string.Format("{0,10} {1,2}", "Week", i);
p++;
if ((p >= cols) && (p % cols == 0))
{
Console.WriteLine(montera);
montera = "";
}
}
Console.WriteLine(montera);
Console.WriteLine("\nBin number 1 is emptied the following weeks ");
Console.WriteLine("-------------------------------------------------------");
}
private static void Bin2()
{
int count = 52;
int p = 0;
const int cols = 3;
string montera = "";
for (int i = 5; i <= count; i += 6)
{
montera += string.Format("{0,10} {1,2}", "Week", i);
p++;
if ((p >= cols) && (p % cols == 0))
{
Console.WriteLine(montera);
montera = "";
}
}
Console.WriteLine(montera);
Console.WriteLine("\nBin number 2 is emptied the following weeks ");
Console.WriteLine("-------------------------------------------------------");
}
public static void Main(string[] args)
{
int choice = -1;
while (choice != 0)
{
WriteMenuText();
choice = int.Parse(Console.ReadLine());
switch (choice)
{
case 1:
{
Bin1();
break;
}
case 2:
{
Bin2();
break;
}
}
}
}
}
} thines01
Postaholic
Team Colleague
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402