在线计算器的作业模板
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
网络程序设计
作业(三)
学院:教育科学与技术学院
班级:2010级教本三班
姓名:王晓洁
学号:100401041326
日期:2011年11月7日
在线计算器的设计与实现一、界面设计
Step1:拖动控件,完成计算器的框架。
Step2:修改控件的属性,是界面更漂亮。
Step3: 添加表格,使按钮更整齐。
Step4:编写算法。
Step5:调试并修改算法。
Step6:添加背景图片。
Step7:调试并执行,完成。
二、程序设计
每一个控件调用的函数及相应函数的代码
public partial class_5_onlineCaculatorWork : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e)
{
}
static double num1, num2;
protected void TextBok1_TextChanged(object sender, EventArgs e) {
}
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Text = TextBox1.Text + "1";
}
protected void Button2_Click1(object sender, EventArgs e)
{
TextBox1.Text = TextBox1.Text + "2";
}
protected void Button3_Click1(object sender, EventArgs e)
{
TextBox1.Text = TextBox1.Text + "3";
}
protected void Button5_Click1(object sender, EventArgs e)
{
TextBox1.Text = TextBox1.Text + "4";
}
protected void Button6_Click1(object sender, EventArgs e)
{
TextBox1.Text = TextBox1.Text + "5";
}
protected void Button7_Click1(object sender, EventArgs e) {
TextBox1.Text = TextBox1.Text + "6";
}
protected void Button9_Click1(object sender, EventArgs e) {
TextBox1.Text = TextBox1.Text + "7";
}
protected void Button10_Click1(object sender, EventArgs e) {
TextBox1.Text = TextBox1.Text + "8";
}
protected void Button11_Click1(object sender, EventArgs e) {
TextBox1.Text = TextBox1.Text + "9";
}
protected void Button13_Click1(object sender, EventArgs e) {
TextBox1.Text = TextBox1.Text + "0";
}
protected void Button14_Click1(object sender, EventArgs e) {
TextBox1.Text = TextBox1.Text + ".";
}
protected void Button4_Click1(object sender, EventArgs e) {
TextBox1.Text = TextBox1.Text;
num1 = Convert.ToDouble(TextBox1.Text);
TextBox1.Text = " ";
string symbols = "+";
Session["Symbols"] = symbols;
}
protected void Button8_Click1(object sender, EventArgs e) {
TextBox1.Text = TextBox1.Text;
num1 = Convert.ToDouble(TextBox1.Text);
TextBox1.Text = " ";
string symbols = "-";
Session["Symbols"] = symbols;
}
protected void Button12_Click1(object sender, EventArgs e)
{
TextBox1.Text = TextBox1.Text;
num1 = Convert.ToDouble(TextBox1.Text);
TextBox1.Text = " ";
string symbols = "*";
Session["Symbols"] = symbols;
}
protected void Button15_Click1(object sender, EventArgs e)
{
TextBox1.Text = TextBox1.Text;
num1 = Convert.ToDouble(TextBox1.Text);
TextBox1.Text = " ";
string symbols = "/";
Session["Symbols"] = symbols;
}
protected void Button17_Click1(object sender, EventArgs e)
{
TextBox1.Text = "";
bool bAppend = true;
int iPrevValue = 0;
string strPrevOpt = "";
}
protected void Button2_Click(object sender, EventArgs e)
{
string symbols = (string)Session["Symbols"];
switch (symbols)
{
case"+":
num2 = Convert.ToDouble(TextBox1.Text);
TextBox1.Text = TextBox1.Text + "+" + TextBox1.Text; TextBox1.Text = (num1 + num2).ToString();
break;
case"-":
num2 = Convert.ToDouble(TextBox1.Text);