Sunteți pe pagina 1din 8

import static java.awt.PageAttributes.MediaType.

A;

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

/**

* @author Ade Setiawan

*/

public class matrix {

public static void main(String[] args){

int Matrix_A [][]={{2,3},{3,4}};

int Matrix_B [][]={{3,4},{4,5}};

int Matrix_C [][]=new int[2][2];

System.out.println(" Matrix-A ");

for(int i=0; i<2; i++){

System.out.println();

for(int j=0; j<2; j++){

System.out.println(" "+Matrix_A [i][j]);

System.out.println(" Matrix-B ");

for(int i=0; i<2; i++){


System.out.println();

for(int j=0; j<2; j++){

System.out.println(" "+Matrix_B [i][j]);

System.out.println(" Matrix-C ");

for(int i=0; i<2; i++){

System.out.println();

for(int j=0; j<2; j++){

Matrix_C[i][j]=Matrix_A[i][j]+Matrix_B[i][j];

System.out.println(" "+Matrix_C[i][j]);

}
/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

package COBA;

/**

* @author Ade Setiawan

*/

public class no9 {

public static void main(String [] args){

String Bulan []
={"Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November
","Desember"};

for(int i = 0;i<Bulan.length;i++){

System.out.print(" "+Bulan[i]);

System.out.println();

String Buland
=("Januari,Februari,Maret,April,Mei,Juni,Juli,Agustus,September,Oktober,November,Desember");

System.out.print(" "+Buland);

}
/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

/**

* @author Ade Setiawan

*/

public class no_8 extends javax.swing.JFrame {

/**

* Creates new form no_8

*/

public no_8() {

initComponents();

/**

* This method is called from within the constructor to initialize the form.

* WARNING: Do NOT modify this code. The content of this method is always

* regenerated by the Form Editor.

*/

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

inputan = new javax.swing.JTextField();


jButton1 = new javax.swing.JButton();

hasil = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jButton1.setText("GENERATE");

jButton1.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton1ActionPerformed(evt);

});

hasil.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(155, 155, 155)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addComponent(inputan)

.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE))

.addContainerGap(152, Short.MAX_VALUE))

.addGroup(layout.createSequentialGroup()

.addContainerGap()

.addComponent(hasil, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addContainerGap())
);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(83, 83, 83)

.addComponent(inputan, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addComponent(jButton1)

.addGap(60, 60, 60)

.addComponent(hasil, javax.swing.GroupLayout.PREFERRED_SIZE, 73,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addContainerGap(30, Short.MAX_VALUE))

);

pack();

}// </editor-fold>

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

Double n=Double.valueOf(inputan.getText());

String status="";

if(n%2==0){

status="GENAP";

else{

status="GANJIL";

hasil.setText("angka tersebut meerupakan bilangan "+status);


}

/**

* @param args the command line arguments

*/

public static void main(String args[]) {

/* Set the Nimbus look and feel */

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">

/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.

* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/

try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(no_8.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(no_8.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(no_8.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {


java.util.logging.Logger.getLogger(no_8.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);

//</editor-fold>

/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new no_8().setVisible(true);

});

// Variables declaration - do not modify

private javax.swing.JLabel hasil;

private javax.swing.JTextField inputan;

private javax.swing.JButton jButton1;

// End of variables declaration

S-ar putea să vă placă și