Anda di halaman 1dari 3

Contoh

Voltage : Proses 1
/*
* 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 prosedur;

import java.util.Scanner;

/**
*
* @author destyrodiah-pc
*/
public class Voltage1 {

/**
* @param args the command line arguments
*/
public static int R,A,V;

public static void main(String[] args) {


// TODO code application logic here
Scanner input = new Scanner(System.in);
System.out.print("Masukkan R :");
R = input.nextInt();
System.out.print("Masukkan A :");
A = input.nextInt();
proses1();
System.out.println("V = " + V);

public static void proses1()


{
V=R*A;
}
}

Voltage : Proses 2
/*
* 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 prosedur;

import java.util.Scanner;
/**
*
* @author destyrodiah-pc
*/
public class Voltage2 {

/**
* @param args the command line arguments
*/

public static void main(String[] args) {


// TODO code application logic here
int tahanan,arus;

Scanner input = new Scanner(System.in);


System.out.print("Masukkan tahanan :");
tahanan = input.nextInt();
System.out.print("Masukkan arus :");
arus = input.nextInt();
proses2(tahanan,arus);
}
public static void proses2(int R,int A)
{
int V;
V=R*A;
System.out.println("V = " + V);

}
}

Tukar
/*
* 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 prosedur;

import java.util.Scanner;

/**
*
* @author destyrodiah-pc
*/
public class Tukar {
public static int x,y;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner input = new Scanner(System.in);
System.out.print("Masukkan x :");
x = input.nextInt();
System.out.print("Masukkan y :");
y = input.nextInt();

proctukar(x, y);

public static void proctukar (int x, int y)


{
int temp;
temp =x;
x=y;
y=temp;
System.out.println("x:"+x);
System.out.println("y:"+y);
}

Anda mungkin juga menyukai