Begin typing your search above and press return to search. Press Esc to cancel.

CONTOH MODUL 2 PROGRAM JAVA METHOD


CONTOH DARI MODUL 2 PROGRAM JAVA METHOD      


     Dari Modul tersebut anda dapat membuat seperti ini "Ini adalah salah satu contoh yang Bisa saya share Ke Public". Bagi anda yang masih belum jelas dengan Contoh yang saya Posting Anda Bisa langsung Berkomentar Di tempat yang telah saya sediakan

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tp2;

/**
 *
 * @author Azharuddin
 */
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Rumus{


    private int x;
    private int y;
    private double fx;
    InputStreamReader isr = new InputStreamReader(System.in);
    BufferedReader Ip = new BufferedReader(isr);

    void inputData(){
    try {
        System.out.print("Masukkan Nilai :");
        this.x = Integer.parseInt(Ip.readLine());
                System.out.print("Masukkan Nilai :");
        this.y = Integer.parseInt(Ip.readLine());
        }
        catch ( Exception e ){
            System.out.println("Masukkan Dengan Benar :"+e);
            }
    hitungFungsi (this.x, this.y);
    }
    void hitungFungsi (int x, int y) {
        //int x = x;
        //int y = y;
        this.fx = (x*y)+(2*x)+(2*y)+6;
        }
    void viewFungsi (){
        System.out.println("Nilai Fungsi : ");
        System.out.println("Nilai X    : "+this.x);
        System.out.println("Nilai Y    : "+this.y);
        System.out.println("Nilai FX    : "+this.fx);
    }
}

    /**
     * @param args the command line arguments
     */
class Tp2 {
    public static void main(String[] args) {
        // TODO code application logic here
        Rumus r=new Rumus ();
    r.inputData();
    r.viewFungsi();
    }
}


SEMOGA BERGUNA BAGI ANDA

TERIMAH KASIH TELAH MENGUNJUNGI APOTIK-ILMU

    No comments:

    Post a Comment