数学测试 计应192(西)第三组 裴岩昊
class Program
{
static void Main(string[] args)
{
mathvoid op = new mathvoid();
string Z = "";
do
{
Console.WriteLine("-------------------------------四则运算-------------------------");
Console.WriteLine("");
Console.WriteLine("请选择您使用的运算方法:1.加法 2.减法 3.乘法 4.除法 5.退出!");
Z = Console.ReadLine();
switch (Z)
{
case "1":
op.mathjia();
continue;
case "2":
op.mathjian();
continue;
case "3":
op.mathcheng();
continue;
case "4":
op.mathchu();
continue;
case "5":
op.result();
break;
default:
Console.WriteLine("输入无效!");
continue;
}
break;
}
while (true);
}
}
public class mathvoid
{
public static int right = 0; //记录答对的总数!
public static int wrong = 0; //记录答错的总数!
public void mathjia() //加法运算!
{
int a, b;
int result;
Random rd = new Random();
a = rd.Next(0, 11);
b = rd.Next(0, 11);
Console.WriteLine("请计算:{0}+{1}=?", a, b);
result = Convert.ToInt32(Console.ReadLine());
if (result == a + b)
{
Console.WriteLine("回答正确!");
right++;
}
else
{
Console.WriteLine("错误,继续努力!");
wrong++;
}
}
public void mathjian() //减法运算!
{
int a, b;
int result;
Random rd = new Random();
a = rd.Next(0, 11);
b = rd.Next(0, 11);
Console.WriteLine("请计算:{0}-{1}=?", a, b);
result = Convert.ToInt32(Console.ReadLine());
if (result == a - b)
{
Console.WriteLine("回答正确!");
right++;
}
else
{
Console.WriteLine("错误,继续努力!");
wrong++;
}
}
public void mathcheng() //乘法运算!
{
int a, b;
int result;
Random rd = new Random();
a = rd.Next(0, 11);
b = rd.Next(0, 11);
Console.WriteLine("请计算:{0}*{1}=?", a, b);
result = Convert.ToInt32(Console.ReadLine());
if (result == a * b)
{
Console.WriteLine("回答正确!");
right++;
}
else
{
Console.WriteLine("错误,继续努力!");
wrong++;
}
}
public void mathchu() //除法运算!
{
int a, b;
int result;
Random rd = new Random();
a = rd.Next(0, 11);
b = rd.Next(0, 11);
if (b != 0)
{
Console.WriteLine("请计算:{0}/{1}=?", a, b);
result = Convert.ToInt32(Console.ReadLine());
if (result == a / b)
{
Console.WriteLine("回答正确!");
right++;
}
else
{
Console.WriteLine("错误,继续努力!");
wrong++;
}
}
else
{
if (a != 0)
{
Console.WriteLine("请计算:{0}/{1}=?", b, a);
result = Convert.ToInt32(Console.ReadLine());
if (result == b / a)
{
Console.WriteLine("回答正确!");
right++;
}
else
{
Console.WriteLine("错误,继续努力!");
wrong++;
}
}
}
}
public void result() //统计结果!
{
Console.WriteLine("总共做了{0}道题:你做对了{1}道题,做错了{2}道题。", right + wrong, right, wrong);
Console.ReadKey();
}
}
}
psp 阶段 花费时间
计划
明确需求和其他元素,估计每个阶段的成本时间 一共2小时
开发 共花了90分钟
需求分析 30分钟
生成设计文档 10分钟
设计复审(和同伴一起) 5分钟
代码规范(为开发制定合适的规范) 30分钟
具体设计 30
具体代码 35
代码复审 5分钟
测试(单元测试) 10分钟
报告 花了半小时左右
测试报告 30分钟
计算工作量 50行有效代码
时事后总结,提出计划 5分钟

浙公网安备 33010602011771号