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

Anasayfa Programlama Java Java İle Hesap Makinesi


Java İle Hesap Makinesi

Java ile yazılmış olan programda bir basit hesap makinesi yapılmıştır. Projede java ile hesap makinesi yapılmıştır, çeşitli buglar (float sayılar için) bulunmakla birlikte bu tarz bir proje için oldukça yararlı bir kaynak olacaktır.
 
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package hesapmakinesi;
  6. /**
  7.  *
  8.  * @author YunusHavin
  9.  */
  10. public class HesapMk extends javax.swing.JFrame {
  11.     //değişkenler
  12.     Double donusumm;
  13.     Double ilkdeger;
  14.     Double [] degerler;
  15.     Double ikincideger;
  16.     Double toplam;
  17.     //tıklamaları kontrol etmek için
  18.     int toplatıkla;
  19.     int cıkartıkla;
  20.     int boltıkla;
  21.     int carptıkla;
  22.    
  23.    
  24.    
  25.     /**
  26.      * Creates new form HesapMk
  27.      */
  28.     public HesapMk() {
  29.         initComponents();
  30.     }
  31.     /**
  32.      * This method is called from within the constructor to initialize the form.
  33.      * WARNING: Do NOT modify this code. The content of this method is always
  34.      * regenerated by the Form Editor.
  35.      */
  36.     @SuppressWarnings("unchecked")
  37.     // <editor-fold defaultstate="collapsed" desc="Generated Code">                         
  38.     private void initComponents() {
  39.         Giris = new javax.swing.JTextField();
  40.         jButton1 = new javax.swing.JButton();
  41.         jButton2 = new javax.swing.JButton();
  42.         jButton3 = new javax.swing.JButton();
  43.         topla = new javax.swing.JButton();
  44.         jButton5 = new javax.swing.JButton();
  45.         jButton6 = new javax.swing.JButton();
  46.         jButton7 = new javax.swing.JButton();
  47.         cıkar = new javax.swing.JButton();
  48.         jButton9 = new javax.swing.JButton();
  49.         jButton10 = new javax.swing.JButton();
  50.         jButton11 = new javax.swing.JButton();
  51.         carp = new javax.swing.JButton();
  52.         jButton13 = new javax.swing.JButton();
  53.         Temizle = new javax.swing.JButton();
  54.         nokta = new javax.swing.JButton();
  55.         bol = new javax.swing.JButton();
  56.         donusum = new javax.swing.JButton();
  57.         eşittir = new javax.swing.JButton();
  58.         Cık = new javax.swing.JButton();
  59.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  60.         Giris.setEditable(false);
  61.         Giris.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
  62.         jButton1.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
  63.         jButton1.setText("1");
  64.         jButton1.addActionListener(new java.awt.event.ActionListener() {
  65.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  66.                 jButton1ActionPerformed(evt);
  67.             }
  68.         });
  69.         jButton2.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
  70.         jButton2.setText("2");
  71.         jButton2.addActionListener(new java.awt.event.ActionListener() {
  72.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  73.                 jButton2ActionPerformed(evt);
  74.             }
  75.         });
  76.         jButton3.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
  77.         jButton3.setText("3");
  78.         jButton3.addActionListener(new java.awt.event.ActionListener() {
  79.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  80.                 jButton3ActionPerformed(evt);
  81.             }
  82.         });
  83.         topla.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
  84.         topla.setText("+");
  85.         topla.addActionListener(new java.awt.event.ActionListener() {
  86.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  87.                 toplaActionPerformed(evt);
  88.             }
  89.         });
  90.         jButton5.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
  91.         jButton5.setText("4");
  92.         jButton5.addActionListener(new java.awt.event.ActionListener() {
  93.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  94.                 jButton5ActionPerformed(evt);
  95.             }
  96.         });
  97.         jButton6.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
  98.         jButton6.setText("5");
  99.         jButton6.addActionListener(new java.awt.event.ActionListener() {
  100.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  101.                 jButton6ActionPerformed(evt);
  102.             }
  103.         });
  104.         jButton7.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
  105.         jButton7.setText("6");
  106.         jButton7.addActionListener(new java.awt.event.ActionListener() {
  107.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  108.                 jButton7ActionPerformed(evt);
  109.             }
  110.         });
  111.         cıkar.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
  112.         cıkar.setText("-");
  113.         cıkar.addActionListener(new java.awt.event.ActionListener() {
  114.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  115.                 cıkarActionPerformed(evt);
  116.             }
  117.         });
  118.         jButton9.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
  119.         jButton9.setText("7");
  120.         jButton9.addActionListener(new java.awt.event.ActionListener() {
  121.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  122.                 jButton9ActionPerformed(evt);
  123.             }
  124.         });
  125.         jButton10.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
  126.         jButton10.setText("8");
  127.         jButton10.addActionListener(new java.awt.event.ActionListener() {
  128.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  129.                 jButton10ActionPerformed(evt);
  130.             }
  131.         });
  132.         jButton11.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
  133.         jButton11.setText("9");
  134.         jButton11.addActionListener(new java.awt.event.ActionListener() {
  135.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  136.                 jButton11ActionPerformed(evt);
  137.             }
  138.         });
  139.         carp.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
  140.         carp.setText("*");
  141.         carp.addActionListener(new java.awt.event.ActionListener() {
  142.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  143.                 carpActionPerformed(evt);
  144.             }
  145.         });
  146.         jButton13.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
  147.         jButton13.setText("0");
  148.         jButton13.addActionListener(new java.awt.event.ActionListener() {
  149.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  150.                 jButton13ActionPerformed(evt);
  151.             }
  152.         });
  153.         Temizle.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
  154.         Temizle.setText("C");
  155.         Temizle.addActionListener(new java.awt.event.ActionListener() {
  156.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  157.                 TemizleActionPerformed(evt);
  158.             }
  159.         });
  160.         nokta.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
  161.         nokta.setText(".");
  162.         nokta.addActionListener(new java.awt.event.ActionListener() {
  163.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  164.                 noktaActionPerformed(evt);
  165.             }
  166.         });
  167.         bol.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
  168.         bol.setText("/");
  169.         bol.addActionListener(new java.awt.event.ActionListener() {
  170.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  171.                 bolActionPerformed(evt);
  172.             }
  173.         });
  174.         donusum.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
  175.         donusum.setText("+/-");
  176.         donusum.addActionListener(new java.awt.event.ActionListener() {
  177.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  178.                 donusumActionPerformed(evt);
  179.             }
  180.         });
  181.         eşittir.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
  182.         eşittir.setText("=");
  183.         eşittir.addActionListener(new java.awt.event.ActionListener() {
  184.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  185.                 eşittirActionPerformed(evt);
  186.             }
  187.         });
  188.         Cık.setText("Çık");
  189.         Cık.addActionListener(new java.awt.event.ActionListener() {
  190.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  191.                 CıkActionPerformed(evt);
  192.             }
  193.         });
 
Yorumlar (0)
Sadece kayıtlı kullanıcılar yorum yazabilir!
Son Güncelleme ( Perşembe, 10 Ocak 2013 23:57 )