/*========================================================================
nama file : input data
tanggal : 14 nov 2011
programmer: hendra silaban
deskripsi : -menginput data
========================================================================*/
import javax.swing.JOptionPane;
class Tahanan
{
public static void main(String[] args)
{
String R1S;
double R1;
String R2S;
double R2;
String R3S;
double R3;
double seri;
double pararel;
R1S = JOptionPane.showInputDialog("masukkan nilai resistor a = ");
R1 = Integer.parseInt(R1S);
R2S = JOptionPane.showInputDialog("masukkan nilai resistor b = ");
R2 = Integer.parseInt(R2S);
R3S = JOptionPane.showInputDialog("masukkan nilai resistor c = ");
R3 = Integer.parseInt(R3S);
seri = R1 + R2 + R3;
pararel = 1/(double)R1 + 1/(double)R2 + 1/(double)R3;
JOptionPane.showMessageDialog(null , "Tahanan total seri : " + seri +
"\nTahanan total pararel : " + pararel);
}
}
Tidak ada komentar:
Posting Komentar