四则运算

PSP流程

个人软件过程(Personal Software Process,PSP)是一种可用于控制、管理和改进个人工作方式的自我持续改进过程,是一个包括软件开发表格、指南和规程的结构化框架。PSP与具体的技术(程序设计语言、工具或者设计方法)相对独立,其原则能够应用到几乎任何的软件工程任务之中。PSP能够说明个体软件过程的原则; 帮助软件工程师作出准确的计划;确定软件工程师为改善产品质量要采取的步骤;建立度量个体软件过程改善的基准;确定过程的改变对软件工程师能力的影响。

//windows.java
package 四则运算; import java.awt.
event.*; import java.sql.*; import javax.swing.*; import java.util.*; public class windows extends JFrame{ JButton button1,button2,button3,button4; windows(){ setLayout(null); setBounds(100,100,400,400); setVisible(true); init(); } void init() { button1 = new JButton("学生考试页面"); button1.setBounds(0,0,150,20); button1.addActionListener(new examPage()); add(button1); } }
//examPage.java
package 四则运算; import java.awt.
*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.math.BigDecimal; import java.sql.*; import java.util.Vector; import javax.swing.*; public class examPage extends JFrame implements ActionListener{ JLabel label01 = new JLabel(); JTextField answer01 = new JTextField(); JButton tijiao = new JButton(); JTextArea tishi = new JTextArea(); FourOpr timu = new FourOpr() ; public void actionPerformed(ActionEvent e) { setLayout(null); setTitle("试卷页面"); setBounds(200,200,400,400); init(); setVisible(true); } void init() { label01.setText(timu.str+"="); label01.setBounds(10,10,200,20); add(label01); answer01.setBounds(220,10,100,20); add(answer01); tijiao.setBounds(300,300,60,30); tijiao.setText("提交"); tijiao.setFont(new Font(null, Font.PLAIN, 13)); tijiao.addActionListener(new tijiao()); add(tijiao); tishi.setBounds(100,100,200,150); add(tishi); } class tijiao implements ActionListener{ public void actionPerformed(ActionEvent e1) { String stuans=answer01.getText(); if(stuans.equals(timu.result)) { tishi.append("you are right! "); } else tishi.append("false!"+timu.str+"="+timu.result); } } }

代码运行结果:

 

原文地址:https://www.cnblogs.com/modiqiang/p/15345504.html