PROGRAM MENGHITUNG GAJI BERSIH (JAVA)
23.17 |
Diposting oleh
Unknown |
Edit Entri
KODE :
package methods;
import
javax.swing.JOptionPane;
import
java.text.DecimalFormat;
public class GajiBersih {
public static double gajibersih (int GP, double UM) {
double GB;
if (GP < 0)
return 0;
else
GB
= GP/100*90 + UM;
return GB;
}
public static void main(String[] args)
{
String
Ulang = "";
do{
String
inputGP = JOptionPane.showInputDialog(null, "MASUKAN GAJI
POKOK + PAJAK 10% ");
int GP = Integer.parseInt(inputGP);
String
inputUM = JOptionPane.showInputDialog(null, "MASUKAN UANG
MAKAN ? ");
double UM = Float.parseFloat(inputUM);
double HasilGB = gajibersih(GP,
UM);
DecimalFormat
x = new DecimalFormat("RP#########");
String
z = x.format(HasilGB);
JOptionPane.showMessageDialog(null, "GAJI BERSIH =
"+z);
Ulang
= JOptionPane.showInputDialog(null, "ULANG LAGI [Y]YA|[T]TIDAK? : ");
}
while ((Ulang.charAt(0) ==
'Y' ) ||
(Ulang.charAt(0) == 'Y' ));
}
}
Langganan:
Postingan (Atom)