Programlama | Programlama Dilleri | C Programlama Dili |C++

Anasayfa Programlama Java Java Applet ?le Kombinasyon


Java Applet ?le Kombinasyon

D??ar?dan textler yard?m? ile al?nan iki say?n?n butona bas?lmas? durumunda kombinasyon sonucunu gsteren program. Netbeans platformunda yaz?lm??t?r. Java da nesne ekleme ve nesneler zerinde i?lemler gerekleltirmeye rnek te?kil eder.

 

  1.  
  2.  
  3. <em>import java.awt.*;
  4. import java.applet.*;
  5. import java.awt.event.*;
  6. import javax.swing.*;
  7. import java.awt.Container;</em>
  8.  
  9. <em>public class kombinasyon extends JApplet {
  10. private JLabel yazi1,yazi2;
  11. private JTextField text1,text2;
  12. private JButton buton;
  13. private Container pencere;
  14. public kombinasyon()
  15. {
  16. pencere= getContentPane();
  17. pencere.setLayout(new FlowLayout());
  18. yazi1 =new JLabel("1. Sayiyi Giriniz"); pencere.add(yazi1);
  19. text1 =new JTextField(20); pencere.add(text1);
  20. buton =new JButton("Hesapla"); pencere.add(buton);
  21. yazi2 =new JLabel("2. Sayiyi Giriniz"); pencere.add(yazi2);
  22. text2 =new JTextField(20); pencere.add(text2);
  23. buton.addActionListener( new ActionListener() {</em>
  24. <em>
  25.  
  26. public void actionPerformed( ActionEvent event )
  27. {
  28. // bul olay?
  29. String bir=text1.getText();
  30. String iki=text2.getText();
  31. if(bir.equals("") || iki.equals(""))
  32. { JOptionPane.showMessageDialog(null, "ncelikle giri?leri yap?n?z"); }
  33. else
  34. {
  35. int fak=1;
  36. int sayi1= Integer.parseInt(bir);
  37. int sayi2=Integer.parseInt(iki);
  38. int fark=sayi1-sayi2;
  39. for(int i=1;i<=sayi1;i++)
  40. fak=fak*i;
  41. int pay=fak;
  42. fak=1;
  43. for(int i=1;i<=fark;i++)
  44. fak=fak*i;
  45. int payda1=fak;
  46. fak=1;
  47. for(int i=1;i<=sayi2;i++)
  48. fak=fak*i;
  49. int payda2=fak;
  50. int butunpayda=payda1*payda2;
  51. int sonuc=pay/butunpayda;
  52. JOptionPane.showMessageDialog(null, sonuc);
  53. }
  54. } // actionperformed sonu
  55.  
  56. } // new action listener sonu
  57.  
  58. );
  59. }
  60. }
  61. </em>
  62.  

Yorumlar (0)
Sadece kayıtlı kullanıcılar yorum yazabilir!
Son Güncelleme ( Çarşamba, 25 Ağustos 2010 00:55 )  
backlinktr.biz | 523: Origin is unreachable

Error 523 Ray ID: 53553b9abcfad3ff • 2019-11-14 01:32:40 UTC

Origin is unreachable

You

Browser

Working
Budapest

Cloudflare

Working
backlinktr.biz

Host

Error

What happened?

The origin web server is not reachable.

What can I do?

If you're a visitor of this website:

Please try again in a few minutes.

If you're the owner of this website:

Check your DNS Settings. A 523 error means that Cloudflare could not reach your host web server. The most common cause is that your DNS settings are incorrect. Please contact your hosting provider to confirm your origin IP and then make sure the correct IP is listed for your A record in your Cloudflare DNS Settings page. Additional troubleshooting information here.