100         public void resetAll(String key) {
101             Fnum.setText("");
102         Snum.setText("");
103         display.setText("");
104         Otext.setText("");
105     }
106     public void getOperator(String key) {
107         Otext.setText(key);
108     }
109
110     public void getEnd(String label) {
111                 if( (countDot(Fnum.getText()) > 1) || (countDot(Snum.getText())>1) || (Fnum.getText().length()==0) ||
(Snum.getText().length() == 0)) {
112                     display.setText("error");
113                 }
114         else if(checkNum(Fnum.getText())==false || checkNum(Snum.getText())==false){
115                 display.setText("error");
116              }
117         else {
118                 double Fnumber = Double.parseDouble(Fnum.getText().trim());
119             double Snumber = Double.parseDouble(Snum.getText().trim());
120             if (Fnum.getText() != "" && Snum.getText() != "") {
121                    if (Otext.getText().indexOf("+") >= 0) {
122                     double CjsEnd = Fnumber + Snumber;
123                     display.setText(String.valueOf(CjsEnd));
124                 }
125                                 else if (Otext.getText().indexOf("-")>=0) {
126                                        double CjsEnd = Fnumber - Snumber;
127                                         display.setText(String.valueOf(CjsEnd));
128                                 }
129                         else if (Otext.getText().indexOf("*")>=0) {
130                                         double CjsEnd = Fnumber * Snumber;
131                                            display.setText(String.valueOf(CjsEnd));
132                                 }
133                                 else if (Otext.getText().indexOf("/")>=0) {
134                                         double CjsEnd = Fnumber / Snumber;
135                                         display.setText(String.valueOf(CjsEnd));
136                                 }
137                 else
138                     display.setText("error");
139
140             }
141             else
142                 display.setText("num is null");
143                 }
144
145     }
146         public int countDot(String str) {
147         int count = 0;
148         for (char c:str.toCharArray()) {
149             if (c == '.')
150                 count++;
151         }
152         return count;
153         }
154         public boolean checkNum(String str) {
155            boolean tmp = true;
156         for (char c:str.toCharArray()) {
157             if (Character.isDigit(c) || (c == '.'));
158             else {
159                 tmp = false;
160                 break;
161             }
162         }
163         return tmp;
164         }
165     public static void main(String[] args) {
166         new CjsCalculator();
167     }
168 }
??????????и?java????????????????