最终项目详细代码(coding地址)/*强的博客/我的详细代码/方言的博客
一、需求分析
1.实现之前项目的功能,如:除了整数之外,还要支持真分数的四则运算,真分数的运算,并且要求能处理用户的输入,并判断错误,打分统计正确率,处理用户输入的真分数,如 1/2, 5/12 等。
2.实现GUI界面。
3.实现记录错题功能,并提供英语,中文繁体服务。
4.实现计算做题使用时间提供给用户。
二、功能设计
计时功能,切换语言功能,兼容获取分式和整数参数功能,生成真分式题目以及最简分式功能,运算功能,校验答案功能。
过滤非法字符功能,题目进度功能,生成用户错题库功能
三、代码展示
1.计时功能
public void thread()
{
int sec = ;
int min = ;
int hour = ; while (true)
{
sec++;
if (sec >=)
{
min++;
sec =;
if (min >=)
{
hour++;
min =;
}
}
s.label10.Text = hour + ":" + min + ":" + sec;
Thread.Sleep();
if (s.next == ) {
break;
}
} }
2.首页切换语言功能
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
this.label1.Text = "Please input the number of math problem";
this.button1.Text = "start";
s.label8.Text = "Time";
s.label1.Text = "Process";
s.button1.Text = "next";
this.Text = "English";
s.Text = "English";
} private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{ } private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
this.label1.Text = "请输入题目数(满分100)";
this.button1.Text = "开始做题";
s.label8.Text = "时间";
s.label1.Text = "题目进度";
s.button1.Text = "下一题";
this.Text = "中文";
s.Text = "中文";
} private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
this.label1.Text = "請輸入題目數(滿分100)";
this.button1.Text = "開始做題";
s.label8.Text = "時間";
s.label1.Text = "題目進度";
s.button1.Text = "下壹題";
this.Text = "中文繁體";
s.Text = "中文繁體";
}
3.过滤非法字符
public string StringClear(string ai)
{
bool temp = bolnum(ai);
if(temp==true)
{
return ai;
}
else
{
cro = ;
if (this.Text == "中文")
{
MessageBox.Show("输入错误");
}
else if (this.Text == "English")
{
MessageBox.Show("input error");
}
else
{
MessageBox.Show("輸入錯誤");
}
this.textBox1.Text = "";
// this.Show();
return "";
}
} public bool bolnum(string temp)
{
for(int i=;i<temp.Length;i++)
{
byte tempByte = Convert.ToByte(temp[i]);
if ((tempByte > ) && (tempByte < ))
return true;
}
return false;
}
4.记录错题功能
FileStream f = new FileStream("cuoti.txt", FileMode.Append, FileAccess.Write);
StreamWriter fi = new StreamWriter(f);
fs = "你的答案:" + this.label2.Text + this.label4.Text + this.label5.Text + this.label9.Text + ai + " 正确答案:" + au + " " + "\r\n";
fi.Write(fs);
fi.Flush();
fi.Close();
f.Close();
四、测试运行
1.首页(中文)及过滤错误字符:
2.检查答案,得出成绩报告单:
3.查看错题及其他语言的部分截图:
五、psp
Personal Software Process Stages |
Estimated Time(min) |
Actual Time (min) |
计划 |
5 |
5 |
·任务估计 |
5 |
5 |
开发 |
100 |
200 |
·需求分析 (包括学习新技术) |
15 |
8 |
·生成设计文档 |
5 |
6 |
·设计复审 |
5 |
3 |
·代码规范 |
1 |
1 |
·具体设计 |
5 |
8 |
·具体编码 |
60 |
200 |
·代码复审 |
5 |
2 |
·测试(自我测试,修改代码,提交修改) |
10 |
20 |
报告 |
30 |
25 |
·测试报告 |
10 |
20 |
·计算工作量 |
5 |
1 |
·提出过程改进计划 |
20 |
10 |
六、总结
在这几天时间里,大家一起努力,学习C#,从无到有。先是一起讨论设计出整体的流程图,再由此基础上分析,解决问题,俗话说,三个臭皮匠,赛过诸葛亮,主要是能够说服对方,无论领航员,还是驾驶员只要 积极地参与,讲出自己的理由,建立共识,才能更好地一起逻辑地思考,分析。
在代码复审的时候,我们优化了一些东西,改进了一些代码,比如可以随机生成有两个运算符的题目。
还有就是通过讨论,改进了过滤的代码,使之不出现错误过滤。
public bool bolnum(string temp)
{
int isfalse=0;
for (int i = 0; i < temp.Length; i++)
{
byte tempByte = Convert.ToByte(temp[i]);
if ((tempByte > 46) && (tempByte < 58))
{ isfalse = 1; }
else
{ return false; }
}
if (isfalse == 1)
{
return true;
}
return false;
}
最终,程序运行如下。
汉堡包式评价?
先来一片面包:在之前的代码基础上,大家决定用C#,没毛病。
再把肉放上:看看要做什么,有空吗,你会吗?没毛病?有bug?不搞了?
着什么急,慢慢来。
这个做的不错,这个有意思。
快做好了。
没毛病。
然后再来一片面包: nice。事情也没想象中的那么那难,风雨俱去烟消散,从流飘荡任东西。