Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- if (hargabaru.getText().equals("")) {
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(wom.this);
- // Setting Judul Dialog
- alertDialog.setTitle("Warning");
- // Setting Pesan Dialog
- alertDialog.setMessage("DP Belum Di Isi");
- // Setting icon untuk Dialog
- // Setting tombol OK
- alertDialog.setNeutralButton("OK",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog,
- int which) {
- // Menulis code dibawah ini akan di eksekusi
- // setelah Dialog keluar
- }
- });
- alertDialog.show();
- }else if(uangmuka.getText().equals("")) {
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(wom.this);
- // Setting Judul Dialog
- alertDialog.setTitle("Warning");
- // Setting Pesan Dialog
- alertDialog.setMessage("Harga Belum Di Isi");
- // Setting icon untuk Dialog
- // Setting tombol OK
- alertDialog.setNeutralButton("OK",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog,
- int which) {
- // Menulis code dibawah ini akan di eksekusi
- // setelah Dialog keluar
- }
- });
- alertDialog.show();
- } else{
- Double hrg,dp,bnga,bln,asuransi;
- hrg = Double.parseDouble(hargabaru.getText().toString());
- dp = Double.parseDouble(uangmuka.getText().toString());
- bnga = Double.parseDouble(text1.getText().toString());
- bln = Double.parseDouble(bulan1.getText().toString());
- asuransi = Double.parseDouble(asuransi1.getText().toString());
- if (hrg < dp) {
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(
- wom.this);
- // Setting Judul Dialog
- alertDialog.setTitle("Warning");
- // Setting Pesan Dialog
- alertDialog.setMessage("Uang Muka Lebih Besar Dari Harga");
- // Setting icon untuk Dialog
- // Setting tombol OK
- alertDialog.setNeutralButton("OK",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog,
- int which) {
- // Menulis code dibawah ini akan di eksekusi
- // setelah Dialog keluar
- uangmuka.setText("");
- hargabaru.setText("");
- }
- });
- alertDialog.show();
- } else {
- Double dpnet = dp - 250000 - (asuransi * hrg);
- Double pokok_hutang = hrg - dpnet;
- Double bunga_angsuran = pokok_hutang * bnga;
- Double angsuran = (pokok_hutang + bunga_angsuran)/bln;
- DecimalFormat df = new DecimalFormat("@@##");
- hasil2.setText("Rp." + df.format(angsuran) + ",00");
- }
- }
- } catch (Exception e) {
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(wom.this);
- // Setting Judul Dialog
- alertDialog.setTitle("Warning");
- // Setting Pesan Dialog
- e.printStackTrace();
- alertDialog.setMessage(e.toString());
- // Setting icon untuk Dialog
- // Setting tombol OK
- alertDialog.setNeutralButton("OK",
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- // Menulis code dibawah ini akan di eksekusi setelah
- // Dialog keluar
- }
- });
- alertDialog.show();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement