Doç. Dr. GÜRAY SONUGÜR

Doç. Dr. Güray SONUGÜR – Öğrenci Bilgi Paylaşım Platformu

Java Kod Örnekleri

3. Soru

import java.util.Random; public class diziler { public static void main(String[] args) { int[] dizi = new int[30]; Random rnd= new Random(); int sayac=0; int toplam=0; for (int i = 0; i < 30; i++) { dizi[i]= rnd.nextInt(300)+100;                 //100 ile 400 arası rasgele sayı üretimi System.out.println(“dizi[” + i […]

2. Soru

Soru 2     import java.util.Scanner; public class daireUcgen { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print(“a değerini giriniz:”); double a = sc.nextDouble(); System.out.print(“b değerini giriniz:”); double b = sc.nextDouble(); System.out.print(“c değerini giriniz:”); double c = sc.nextDouble(); double s=(a+b+c)/2; double R = (a*b*c)/(Math.sqrt((s*(s-a)*(s-b)*(s-c)))*4); System.out.println(“Sonuç: ” + R); } }   […]

1. Soru

    String[] dizi = new String[2]; //combobox dolduruluyor. dizi[0] = “Santigrat”; dizi[1] = “Fahrenayt”; ComboBoxModel comboModel = new DefaultComboBoxModel(dizi); cmbCikis.setModel(comboModel); JButton btnCevir = new JButton(“\Cevir”); btnCevir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if (txtSckGiris.getText().isEmpty()) //boş giriş kontrolü { txtSckSonuc.setText(“Alanlar boş geçilemez!”); } else { double sckGiris=Double.parseDouble(txtSckGiris.getText()); double sckSonuc=0; txtSckSonuc.setText(“”); if (rdySantigratIlk.isSelected()&& cmbCikis.getSelectedItem()==”Santigrat”) { […]

Oto Fiyat Hesaplama

                            import java.awt.EventQueue; import javax.swing.ComboBoxModel; import javax.swing.DefaultComboBoxModel; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JComboBox; import javax.swing.JCheckBox; import javax.swing.JPanel; import java.awt.FlowLayout; import javax.swing.UIManager; import javax.swing.JRadioButton; import javax.swing.JTextField; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.ButtonGroup; import java.awt.Color; import java.awt.Font; public class OtoFiyat { private […]

2. soru ve yanıtı

import java.awt.EventQueue; import javax.swing.ComboBoxModel; import javax.swing.DefaultComboBoxModel; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JRadioButton; import javax.swing.JButton; import javax.swing.JTextField; import javax.swing.JComboBox; import javax.swing.JPanel; import javax.swing.UIManager; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.ButtonGroup; import java.awt.Color; import java.awt.Font; import javax.swing.event.ChangeListener; import javax.swing.event.ChangeEvent; public class UrunSatis { private JFrame frmrnSat; private JTextField txtUrunAdi; private JTextField txtUrunFiyati; private JTextField txtUrun; private JTextField txtToplam; […]

1.soru ve yanıtı

  import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.JRadioButton; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.SwingConstants; import javax.swing.plaf.basic.BasicBorders.RadioButtonBorder; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.Color; public class IsciUcretleri { private JFrame frame; private JTextField txtSaatUcreti; private JTextField txtHafta; private JTextField txtFazlaMesai; private final ButtonGroup buttonGroup = new ButtonGroup(); private JTextField txtToplamUcret; private JTextField txtVergi; private […]

Dosya Okuma

              Okunan dosya örneği   import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JLabel; import java.awt.Color; import javax.swing.JTextField; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; public class DosyaOku { private JFrame frame; private JTextField txtDosyaAdi; private JTextField txtIcerik; private JTextField txtAdSoyad; private JTextField […]

Sayı Tahmin Oyunu

            import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import java.awt.Color; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class SayiTahminOyunu { private JFrame frmSayTahminOyunu; private JTextField txtSayi; private JTextField txtTahmin; private JTextField txtSayac; private JTextField txtMesaj; public int sayac = 0; /** * Launch the application. */ public static void […]

İlk Uygulama (Devamı)

                    import java.awt.EventQueue; import java.awt.TextArea; import javax.swing.ComboBoxModel; import javax.swing.DefaultComboBoxModel; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JTextField; import java.awt.Color; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JTextArea; import java.awt.Font; import javax.swing.JComboBox; import javax.swing.JCheckBox; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.event.ChangeListener; import javax.swing.event.ChangeEvent; import javax.swing.JRadioButton; import javax.swing.JPanel; import […]

Previous Posts