《软件测试技术》
实验报告
河北工业大学计算机科学与软件学院
2017年9月
软件说明
电话号码问题
某城市电话号码由三部分组成。它们的名称和内容分别是:
地区码:空白或三位数字;
前 缀:非'0'或'1'的三位数字;
后 缀:4位数字。
流程图
源代码 import java.awt.*; import java.awt.event.*;
public class PhoneNumber extends Frame implements ActionListener{
/** *
*/ private static final long serialVersionUID = 1L;
private final String[] st = {Name,Local,Prefix,Suffix};
static int c_person=0;
TextField t_name,t_local,t_prefix,t_suffix;
RecordDialog d_record;
MessageDialog d_message;
person a[]=new person[100];
public PhoneNumber()
{
畳数?电话号码 );
this.setSize(250,250);
this.setLocation(300,240);
Panel panel1 = new Panel(new GridLayout(4, 1));
for (int i = 0; i < st.length; i++)
panel1.add(new Label(st[i],0));
Panel panel2 = new Panel(new GridLayout(4, 1));
t_name =new TextField(\,20);
t_local =new TextField(\);
t_prefix=new TextField(\);
t_suffix=new TextField(\);
panel2.add(t_name);
panel2.add(t_local);
panel2.add(t_prefix);
panel2.add(t_suffix);
Panel panel3 = new Panel(new FlowLayout());
Button b_save = new Button(Save);
Button b_record= new Button(Record);
panel3.add(b_save);
panel3.add(b_record);
this.setLayout(new BorderLayout());
this.add(West, panel1);
this.add(East, panel2);
this.add(South, panel3);
addWindowListener(new WindowCloser());
b_save.addActionListener(this);
b_record.addActionListener(this);
d_record=new RecordDialog(this);
d_message=new MessageDialog(this);
this.setVisible(true);
}
private class RecordDialog extends Dialog{
private static final long serialVersionUID = 1L;
Frame frame; //对话框所依赖的框架窗口
TextArea t_show;
RecordDialog(Frame frame){
畳数?牦浡?记录,true);
this.frame=frame;
this.setSize(300, 80);
t_show=new TextArea(20,20);
this.add(t_s