Avezbayeva Ozoda
Download 19.38 Kb.
|
Calculator02
- Bu sahifa navigatsiya:
- //Matematik amallar kodi;
- // 2lik sanoq sistemasiga o’tish kodi
- // 8lik sanoq sistemasiga o’tish kodi
- // 10 lik sanoq sistemasiga o’tish kodi
// Avezbayeva Ozoda; String s="",hisob=""; long son; private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) { s=s+evt.getActionCommand(); text1.setText(s); } //raqmlar kodi; private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) { if(!s.equals("")){ switch(hisob){ case"":son= Long.parseLong(s);break; case"+":son= (son + Long.parseLong(s));break; case"-":son= (son - Long.parseLong(s));break; case"*":son= (son * Long.parseLong(s));break; case"/":son= (son / Long.parseLong(s));break; case"x^n":son= (long) (Math.pow(son, Long.parseLong(s)));break; } s=""; text1.setText(String.valueOf(son)); } hisob=evt.getActionCommand(); if(hisob.equals("C")){ text1.setText(""); s=""; hisob=""; }
private void jButton19ActionPerformed(java.awt.event.ActionEvent evt) {
private void jButton20ActionPerformed(java.awt.event.ActionEvent evt) { int q=Integer.parseInt(text1.getText()); int massiv[]=new int[q]; int i=0,f=0; while(q>0){ i=q%8; q=q/8; massiv[f]=i; f++; } String w=""; while(f>0){ w+=(massiv[f-1]); f--; } text1.setText(String.valueOf(w)); } // 8lik sanoq sistemasiga o’tish kodi private void jButton17ActionPerformed(java.awt.event.ActionEvent evt) { int q=Integer.parseInt(text1.getText()); int massiv[]=new int[q]; int i=0,f=0; while(q>0){ i=q%10; q=q/10; massiv[f]=i; f++; } String w=""; while(f>0){ w+=(massiv[f-1]); f--; } text1.setText(String.valueOf(w)); } // 10 lik sanoq sistemasiga o’tish kodi private void jButton25ActionPerformed(java.awt.event.ActionEvent evt) { double x=Double.parseDouble(text1.getText()); text1.setText(String.valueOf(Math.sin(x))); } // sin(x) kodi; private void jButton21ActionPerformed(java.awt.event.ActionEvent evt) { double x=Double.parseDouble(text1.getText()); text1.setText(String.valueOf(Math.cos(x))); } // cos(x) kodi; private void jButton24ActionPerformed(java.awt.event.ActionEvent evt) { double x=Double.parseDouble(text1.getText()); text1.setText(String.valueOf(Math.tan(x))); } // tg(x) kodi; private void jButton23ActionPerformed(java.awt.event.ActionEvent evt) { double x=Double.parseDouble(text1.getText()); text1.setText(String.valueOf(1/(Math.tan(x)))); } // ctg(x) kodi; private void jButton22ActionPerformed(java.awt.event.ActionEvent evt) { double x=Integer.parseInt(text1.getText()); text1.setText(String.valueOf(Math.log10(x))); } // logarif kodi; Download 19.38 Kb. Do'stlaringiz bilan baham: |
ma'muriyatiga murojaat qiling