3/29日小作业,上一个任务的拓展,对三个输入框的检测。
2015-03-29 21:35
127 查看
要求:对上一次的作业进行拓展,同时检测三个输入文本。
对每个输入框的有效等价类与无效等价类与上次的相同。
测试用例如下:
*注test2输入2为无输入。
屏幕截图如下
View Code
全部文件如下(vs2013)
http://files.cnblogs.com/files/limiting/3InputVersion.rar
对每个输入框的有效等价类与无效等价类与上次的相同。
测试用例如下:
编号 | 输入1 | 输入2 | 输入3 | 预期输出 | 实际输出 |
test1 | 123456 | abcdef | abc123 | √√√ | 符合 |
test2 | !@#$% | 1234567 | ××× | 符合 | |
test3 | abc | 测试 | 123!@# | √×× | 符合 |
屏幕截图如下
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Text.RegularExpressions; namespace WindowsFormsApplication3 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { String text1 = textBox1.Text; String text2 = textBox2.Text; String text3 = textBox3.Text; label4.Text = check_Text(text1, 0); label5.Text = check_Text(text2, 0); label6.Text = check_Text(text3, 0); } public String check_Text(String text, int mode) { return check_Text(text) == 0 ? "√" : "×"; } public int check_Text(String text) { Regex regex = new Regex(@"^[A-Za-z0-9]+$"); int result = -1; if (text.Length > 6 || text.Length < 1) { result = 1; } else if (!regex.IsMatch(text)) { result = 2; } else { result = 0; } return result; } } }
View Code
全部文件如下(vs2013)
http://files.cnblogs.com/files/limiting/3InputVersion.rar
相关文章推荐
- 第六周任务四设计一个三角形类,能够输入三角形的三个顶点,求出其面积、周长,并判断其是否为直角三角形和等腰三角形。
- 第六周实验报告 任务4 设计一个三角形类 输入三角形的三个顶点 求面积周长
- 从视频文件中读入数据-->将数据转换为灰度图-->对图像做canny边缘检测-->将这三个结构显示在一个图像中
- 第六周实验指导--任务四--设计一个三角形类,能够输入三角形的三个顶点,求出其面积、周长。
- 一个MapReuce作业的从开始到结束--第6章Hadoop以Jar包的方式执行MapReduce任务
- JAVA--第十三周任务一封装一个求一元二次方程根的类SquareEquation,要求考虑解方程的异常,再编写一个窗口类EquationFrame。要求窗口使用三个文本框和一个文本区,其中三个文本框
- 在linux中循环一个作业任务
- 3007.脚本作业―l201.5.0编写一个脚本用于检测IP地址(递进版5)
- 3006.脚本作业―l201.4.0编写一个脚本用于检测IP地址(递进版4)
- 练习:创建一个按钮,点击一次,则创建一个<input type="text"><input> 点击三次按钮,应该有三个输入框被创建出来。
- 3011.脚本作业―l201.9.0编写一个脚本用于检测IP地址(递进版9)
- C++第六周任务4设计一个三角形类,能够输入三角形的三个顶点,求出其面积、周长,并判断其是否为直角三角形和等腰三角形。
- 3005.脚本作业―l201.3.0编写一个脚本用于检测IP地址(递进版3)
- 3009.脚本作业―l201.7.0编写一个脚本用于检测IP地址(递进版7)
- 作业: 编写一个JFrame窗口,要求如下: 1. 在窗口的NORTH区放置一个JPanel面板。 2. JPanel面板放置如下组件: (1) JLable标签,标签文本为“兴趣”,右边接着是三个J
- 第十三周 任务三 设计一个抽象基类,生出三个派生类
- 对于一个输入框要做哪些安全性检测(腾讯一面题目)
- 3004.脚本作业―l201.2.0编写一个脚本用于检测IP地址(递进版2)
- 3010.脚本作业―l201.8.0编写一个脚本用于检测IP地址(递进版8)
- 第六周实验指导--任务五--设计一个三角形类,能够输入三角形的三个顶点,求出其面积、周长。