还有就是直接重载是什么??
难道说版主的意思是这样写?
using System;
namespace ForecastSystem
{
/// <summary>
/// method_weight 的摘要说明。
/// </summary>
public class method_twice
{
//private variables to hold class properties
private string strTime;
private int intArrayNumber;
private decimal decQuantity,decWeight,decInitial1,decInitial2,decSingleTotal,decResult,decMSE;
private static int intCount;
private static decimal []decSingle=new decimal[100];
private static decimal []decTotal_number1=new decimal[100];
private static decimal []decTotal_number2=new decimal[100];
public method(int intArrayNumber,decimal decWeight,string strTime,decimal decQuantity,decimal decInitial1)
{
//
this.Time=strTime;
this.Quantity=decQuantity;
this.Weight=decWeight;
this.Initial1=decInitial1;
this.ArrayNumber=intArrayNumber;
AddTotals1();
Add_number1();
Forecast1();
CalculateMSE1();
//
}
public method(int intArrayNumber,decimal decWeight,string strTime,decimal decQuantity,decimal decInitial1,decimal decInitial2)
{
//
this.Time=strTime;
this.Quantity=decQuantity;
this.Weight=decWeight;
this.Initial1=decInitial1;
this.Initial2=decInitial2;
this.ArrayNumber=intArrayNumber;
AddTotals2();
Add_number2();
Forecast2();
CalculateMSE2();
//
}
......
protected void AddTotals1()
{
decTotal_number1[0]=decInitial;
decSingle[intCount]=decQuantity;
intCount++;
}
protected void Add_number1()
{
if(intArrayNumber<=intCount)
{
for(int a=0;a<intArrayNumber;a++)
{
decTotal_number1[a+1]=decWeight*decSingle[a]+(1-decWeight)*decTotal_number1[a];
}
}
}
protected void Forecast1()
{
decResult=decTotal_number1[intArrayNumber];
}
protected void CalculateMSE1()
{
if(intArrayNumber<=intCount)
{
for(int a=0;a<intArrayNumber;a++)
{
decSingleTotal+=(decSingle[a]-decTotal_number1[a])*(decSingle[a]-decTotal_number1[a]);
}
decMSE=decSingleTotal/intArrayNumber;
decSingleTotal=0;
}
}
protected void AddTotals2()
{
decTotal_number1[0]=decInitial1;
decTotal_number2[0]=decInitial2;
decSingle[intCount]=decQuantity;
intCount++;
}
protected void Add_number2()
{
if(intArrayNumber<=intCount)
{
for(int a=0;a<intArrayNumber;a++)
{
decTotal_number1[a+1]=decWeight*decSingle[a]+(1-decWeight)*decTotal_number1[a];
decTotal_number2[a+1]=decWeight*decTotal_number1[a]+(1-decWeight)*decTotal_number2[a];
}
}
}
protected void Forecast2()
{
decResult=decTotal_number2[intArrayNumber];
}
protected void CalculateMSE2()
{
if(intArrayNumber<=intCount)
{
for(int a=0;a<intArrayNumber;a++)
{
decSingleTotal+=(decSingle[a]-decTotal_number2[a])*(decSingle[a]-decTotal_number2[a]);
}
decMSE=decSingleTotal/intArrayNumber;
decSingleTotal=0;
}
}
}
}