帮我这个C#程序弄下注解 谢谢
using System;using System.Collections.Generic;
using System.Text;
namespace 年月日
{
class onetest
{
private int Nian;
private int Ye;
private int Ri;
public bool m = false;
public onetest() { }
public onetest(int nian,int ye,int ri)
{
Nian = nian;
if (ri > 0 && ri < 32)
{
Ri = ri;
}
else
{
Console.WriteLine("一个月最多有31天!");
m = true;
}
if ((ye == 2 && ri > 28))
{
Console.WriteLine("2月只有28天,如果是闰年,最后会自动加上一天的!");
m = true;
}
else if ((ye == 4 && ri == 31) || (ye == 6 && ri == 31) || (ye == 9 && ri == 31) || (ye == 11 && ri == 31))
{
Console.WriteLine(ye + "没有31天!");
m = true;
}
else
{
}
if (ye > 0 && ye <= 12)
{
Ye = ye;
}
else
{
Console.WriteLine("一年最多有12个月!");
m = true;
}
}
public int Jisuanjieguo(int nian,int ye,int ri)
{
int sum = 0;
switch (ye)
{
case 1:
sum = 0;
break;
case 2:
sum = 31;
break;
case 3:
sum = 31 + 28;
break;
case 4:
sum = 31 + 28+31;
break;
case 5:
sum = 31 + 28+31+30;
break;
case 6:
sum = 31 + 28+31+30+31;
break;
case 7:
sum = 31 + 28+31+30+31+31;
break;
case 8:
sum = 31 + 28+31+30+31+30+31;
break;
case 9:
sum = 31 + 28+31+30+31+30+31+31;
break;
case 10:
sum = 31 + 28+31+30+31+30+31+31+30;
break;
case 11:
sum = 31 + 28+31+30+31+30+31+31+30+31;
break;
default:
sum = 31 + 28+31+30+31+30+31+31+30+31+30;
break;
}
if ((ye == 2 && nian % 4 == 0) && (nian % 100 != 0) || (nian% 400 == 0))
{
sum =sum+1;
}
return sum+ri;
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("\t\t\t计算天数系统\n");
Console.WriteLine("注意:在输入年月日时要使用“_“隔开。例如:2008_8_8\n");
while (true)
{
try
{
int sum = 0;
int Nian, Ye, Ri;
string s;
Console.Write("请输入日期:");
s = Console.ReadLine();
string[] s1 = s.Split('_');
Nian = Convert.ToInt32(s1[0]);
Ye = Convert.ToInt32(s1[1]);
Ri = Convert.ToInt32(s1[2]);
onetest newonetest = new onetest(Nian, Ye, Ri);
if (newonetest.m == true)
{
continue;
}
sum = newonetest.Jisuanjieguo(Nian, Ye, Ri);
Console.WriteLine(Nian + "年" + Ye + "月" + Ri + "日是这一年的第" + sum + "天");
Console.ReadLine();
break;
}
catch (Exception e1)
{
Console.WriteLine("你输入的格式不正确,请重新输入。"+e1.ToString()+"\n");
}
}
}
}
}
帮我弄下注解 能修改下最好