Sebelumnya, importkan terlebih dahulu
“import java.text.DecimalFormat;”
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
double hasil = 0;
DecimalFormat model = new DecimalFormat("#0.0#");
double suhuawal = 0;
suhuawal = Double.parseDouble(txtsuhu.getText());
if (jComboBox1.getSelectedIndex() == 0){
hasil = (suhuawal + 459.67)/1.8;
}else{
hasil = (suhuawal / 1.8) - 459.67;
}
txthasil.setText(String.valueOf(model.format(hasil)));
}
KITA TIDAK SELALU BISA MEMBANGUN MASA DEPAN UNTUK GENERASI MENDATANG, TAPI KITA BISA MEMPERSIAPKAN GENERASI MENDATANG UNTUK MASA DEPAN
Tidak ada komentar:
Posting Komentar