Web应用开发技术实验报告
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
实验一:简单计算器
实验代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class c1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void change1(object sender, EventArgs e)
{
double n1 = double.Parse(t1.Text) + double.Parse(t2.Text);
this.t4.Text = n1.ToString();
}
protected void change2(object sender, EventArgs e)
{
double n1 = double.Parse(t1.Text) - double.Parse(t2.Text);
this.t4.Text = n1.ToString();
}
protected void change3(object sender, EventArgs e)
{
double n1 = double.Parse(t1.Text) * double.Parse(t2.Text);
this.t4.Text = n1.ToString();
}
protected void change4(object sender, EventArgs e)
{
double n1 = double.Parse(t1.Text) / double.Parse(t2.Text);
this.t4.Text = n1.ToString();
}
}
界面:
运行界面:
实验二:个人所得税
实验代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class tax_Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
double a = Convert.ToDouble(TextBox1.Text);
double c =a-3500;
if (c <= 0)
{
TextBox1.Text = "工¤资哩?收?入?大洙??500才?纳é税©,?清?重?新?输?入?"; }
else if (c <= 1500)
{
TextBox4.Text = Convert.ToString(c * 0.03);
TextBox5.Text = Convert.ToString(a - c * 0.03); /*将?一?个?基õ本?数簓据Y类え?型í转羇为a另ⅷ?一?个?基õ本?类え?型í,?
* 将?指?定¨的?双?精?度è浮?点?数簓的?值μ转羇换?其?等台?效§的?字?符?串?表括?示?形?式?*/
}
else if (1500 < c && c <= 4500)
{
TextBox4.Text = Convert.ToString(c * 0.1 - 105);
TextBox5.Text = Convert.ToString(a - (c * 0.1 - 105));
}
else if (4500 { TextBox4.Text = Convert.ToString(c * 0.2 - 555); TextBox5.Text = Convert.ToString(a - (c * 0.2 - 555)); } else if (9000 < c && c <= 35000) { TextBox4.Text = Convert.ToString(c * 0.25 - 1005); TextBox5.Text = Convert.ToString(a - (c * 0.25 - 1005)); } else if (35000 < c && c <= 55000) { TextBox4.Text = Convert.ToString(c * 0.3 - 2755); TextBox5.Text = Convert.ToString(a - (c * 0.3 - 2755)); } else if (55000 < c && c <= 80000) { TextBox4.Text = Convert.ToString(c * 0.35 - 5505); TextBox5.Text = Convert.ToString(a - (c * 0.35 - 5505)); } else if (80000 < c) { TextBox4.Text = Convert.ToString(c * 0.45 - 13505); TextBox5.Text = Convert.ToString(a - (c * 0.45 - 13505)); } } protected void Button2_Click(object sender, EventArgs e) { TextBox1.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; } }