using system;
using system.collections.generic;
using system.linq;
using system.text;
namespace state
};public
class cgumballmachine
else
}//property
public istate stateofmechine
set}
public
int ncount
set}
//member function
public
string insertquarter()
public
string ejectquarter()
public
string turncrank()
public
string releaseball()
return
"a gumball comes rolling out the slot.../n";
}public
string refill(int ngumballs)
this.m_ncount += ngumballs;
this.m_statecurrent = this.m_statenoquareter;
return
"/nrefill: " + ngumballs + "gumballs were added. " + "the gumball count is: " + this.m_ncount;
}public
string machinestateheader()
return sbresult.tostring();
}//data member
private istate m_statesoldout;
private istate m_statenoquareter;
private istate m_statehasquareter;
private istate m_statesoldstate;
private istate m_statecurrent;
private
int m_ncount;
};
public
inte***ce istate
;
public
class csoldstate : istate
//inhert from istate
public
string insertquarter()
public
string ejectquarter()
public
string turncrank()
public
string dispense()
else
return stroutput;
}public
override
string tostring()
private cgumballmachine m_objgbmachine;
private istate m_statenoquarter;
private istate m_statesoldout;
};public
class csoldoutstate : istate
//inhert from istate
public
string insertquarter()
public
string ejectquarter()
public
string turncrank()
public
string dispense()
public
override
string tostring()
private cgumballmachine m_objgbmachine;
};public
class cnoquarterstate : istate
//inhert from istate
public
string insertquarter()
public
string ejectquarter()
public
string turncrank()
public
string dispense()
public
override
string tostring()
private cgumballmachine m_objgbmachine;
private istate m_statehasquarter;
};public
class chasquarterstate : istate
//inhert from istate
public
string insertquarter()
public
string ejectquarter()
public
string turncrank()
else
return stroutput;
}public
string dispense()
public
override
string tostring()
private cgumballmachine m_objgbmachine;
private istate m_statenoquarter;
};public
class cwinnerstate : istate
//inhert from istate
public
string insertquarter()
public
string ejectquarter()
public
string turncrank()
public
string dispense()
else
else
}return stroutput;
}
public
override
string tostring()
private cgumballmachine m_objgbmachine;
private istate m_statenoquarter;
private istate m_statesoldout;};}
vue webpack 專案搭建環境(沒寫完)
一 搭建環境 安裝node.js npm init初始化專案 npm install webpack vue vue loader css loader 安裝依賴包 如果提示要安裝 vue template complier,npm install vue template complier即可。安...
Matlab插值與資料擬合(沒寫完)
對給定的n個插值點x1,x2,x3 xn xi的值互不相同 及對應的函式值y1,y2,y3 yn,利用構造的n 1次lagrange插值多項式,則對插值區間內任意的x的函式值y可通過下式求得 lagrange函式matlab lagrange.m function y lagrange x0,y0,...
ECG曲率計算,曲線擬合(還沒寫完)
0,最小二乘法 又稱最小平方法,是一種數學優化技術,通過最小化誤差的平方和尋找資料的最佳函式匹配,利用最小二乘法可以簡便的求得位置的資料,並使得這些求得的資料和實際的資料之間的誤差的平方和為最小。最小二乘法還可以用於曲線擬合。其他一些優化問題也可以通過最小化能量或最大化熵用最小二乘法來表達。選擇最佳...