JAVA代码(面向对象程序设计) 联系客服

发布时间 : 星期一 文章JAVA代码(面向对象程序设计)更新完毕开始阅读da894f5d2bf90242a8956bec0975f46527d3a7a9

import java.awt.*;

import java.awt.event.*;

class GEquation extends Frame implements ActionListener { TextField fa, fb, fc, fx1, fx2; Button btn; public GEquation() { this.setLayout(new FlowLayout()); fa = new TextField(8); fb = new TextField(8); fc = new TextField(8); fx1 = new TextField(20); fx2 = new TextField(20); add(fa); add(fb); add(fc); btn = new Button(\ add(btn); add(fx1); add(fx2); this.setSize(200,200); this.setVisible(true); } public void actionPerformed(ActionEvent e) { double a = Double.parseDouble(fa.getText()); double b = Double.parseDouble(fb.getText()); double c = Double.parseDouble(fc.getText()); Equation e1 = new Equation(a, b, c); if (e1.getDelta() >= 0) { fx1.setText(Double.toString(e1.getRootage1())); fx2.setText(Double.toString(e1.getRootage2())); } if (e1.getDelta() < 0) { fx1.setText(\无解\ fx2.setText(\ } } }

public class testGEquation { public static void main(String[] args) { GEquation ge=new GEquation(); } }