package com.suanshu;
import java.awt.*;
import java.awt.event.*;
import java.util.*;

import javax.swing.*;
public class ConIn {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		MyFrame mf=new MyFrame();
	}

}

class MyFrame extends JFrame implements ActionListener{
	double zongxuefen=0;
	double zongchengji=0;
	double rrr=0;
	ArrayList<Porject> al= new ArrayList<Porject>();
	JPanel jp,jpp;
	JTextField jt1,jt2;
	JLabel jl,xuefen,chengji,result;
	JButton tianjia,qingkong;
	JButton jisuan;

	public MyFrame() {
		// TODO Auto-generated constructor stub
		
		qingkong=new JButton("");
		qingkong.addActionListener(this);
		jl=new JLabel("ӿĿ"+al.size()+"");
		jp=new JPanel();
		xuefen=new JLabel("ѧ:");
		chengji =new JLabel("ɼ:");
		jt1=new JTextField(7);

		jt2=new JTextField(7);
		tianjia=new JButton("");
		tianjia.addActionListener(this);
		jp.add(xuefen);
		jp.add(jt1);
		
		jp.add(chengji);
		jp.add(jt2);
		jp.add(tianjia);
		jp.add(jl);
		
		result=new JLabel("ƽѧּΪ");
		result.setFont(new Font("",Font.PLAIN,38));
		jp.add(result);
		this.add(jp);
		
		jpp=new JPanel();
		jpp.add(qingkong);
		this.add(jpp,"South");
		this.setSize(400,180);
		this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		this.setVisible(true);
		this.setTitle("ƽѧּ");

	}

	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		if(e.getSource()==tianjia){
			if(!(jt1.getText().equals("")||jt2.getText().equals(""))){
				double a=Double.parseDouble(jt1.getText());
				double b=Double.parseDouble(jt2.getText());
				Porject p=new Porject(a, b);
				al.add(p);
				
				zongxuefen+=a;
				zongchengji+=p.all;
				rrr=zongchengji/zongxuefen;
				
				jt1.setText("");
				jt2.setText("");
				
			}else{
				System.out.println("");
			}
			
		}else if(e.getSource()==qingkong){
			al=new ArrayList<Porject>();
			 zongxuefen=0;
			 zongchengji=0;
			 rrr=0;
		}
		
		jl.setText("ӿĿ"+al.size()+"");
		result.setText("ƽѧּΪ"+rrr);
		this.validate();
	}
	
}

class Porject{
	double xuefen;
	double chengji;
	double all;
	public Porject(double xuefen,double chengji) {
		// TODO Auto-generated constructor stub
		this.xuefen=xuefen;
		this.chengji=chengji;
		this.all=xuefen*chengji;
	}
}
@@ -82,18 +82,16 @@
 til.*;%0D%0A
-%0D%0A
 import j
@@ -631,24 +631,26 @@
 ew JButton(%22
+%E6%B8%85%E7%A9%BA
 %22);%0D%0A%09%09qingk
@@ -696,18 +696,24 @@
 JLabel(%22
-%D3%BF%C4%BF
+%E5%B7%B2%E6%B7%BB%E5%8A%A0%E7%A7%91%E7%9B%AE%E6%95%B0%E9%87%8F%EF%BC%9A
 %22+al.siz
@@ -763,17 +763,18 @@
 JLabel(%22
-%D1%A7
+%E5%AD%A6%E5%88%86
 :%22);%0D%0A%09%09
@@ -798,9 +798,10 @@
 el(%22
-%C9%BC
+%E6%88%90%E7%BB%A9
 :%22);
@@ -879,16 +879,18 @@
 Button(%22
+%E6%B7%BB%E5%8A%A0
 %22);%0D%0A%09%09t
@@ -1057,20 +1057,23 @@
 JLabel(%22
-%C6%BD%D1%A7%D6%BC%CE%AA
+%E5%B9%B3%E5%9D%87%E5%AD%A6%E5%88%86%E7%BB%A9%E4%B8%BA%EF%BC%9A
 %22);%0D%0A%09%09r
@@ -1096,16 +1096,18 @@
 w Font(%22
+%E5%AE%8B%E4%BD%93
 %22,Font.P
@@ -1355,19 +1355,24 @@
 tTitle(%22
-%C6%BD%D1%A7%D6%BC
+%E5%B9%B3%E5%9D%87%E5%AD%A6%E5%88%86%E7%BB%A9%E8%AE%A1%E7%AE%97%E5%99%A8
 %22);%0D%0A%0D%0A%09
@@ -1890,16 +1890,21 @@
 rintln(%22
+%E8%AF%B7%E5%A1%AB%E5%85%A5%E6%95%B0%E5%AD%97
 %22);%0D%0A%09%09%09
@@ -2060,10 +2060,16 @@
 xt(%22
-%D3%BF%C4%BF
+%E5%B7%B2%E6%B7%BB%E5%8A%A0%E7%A7%91%E7%9B%AE%E6%95%B0%E9%87%8F%EF%BC%9A
 %22+al
@@ -2104,12 +2104,15 @@
 xt(%22
-%C6%BD%D1%A7%D6%BC%CE%AA
+%E5%B9%B3%E5%9D%87%E5%AD%A6%E5%88%86%E7%BB%A9%E4%B8%BA%EF%BC%9A
 %22+rr
@@ -2386,8 +2386,10 @@
 ;%0D%0A%09%7D%0D%0A%7D
+%0D%0A

Update ConIn.java