Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
- Float Total;
- Float Change;
- Double Amnt = new Double(SaleAmt.getText());
- Double Cash = new Double(CashAmt.getText());
- Cash *= 100;
- Amnt *= 100;
- Change = Cash.floatValue() - Amnt.floatValue();
- Total = Cash.floatValue() - Amnt.floatValue();
- ChngDue.setText("$" + new Float(Change/100).toString());
- twenty.setText(new Integer(Total.intValue() / 2000).toString());
- Total %= 2000;
- ten.setText(new Integer(Total.intValue() / 1000).toString());
- Total %= 1000;
- five.setText(new Integer(Total.intValue() / 500).toString());
- Total %= 500;
- two.setText(new Integer(Total.intValue() / 200).toString());
- Total %= 200;
- dollar.setText(new Integer(Total.intValue() / 100).toString());
- Total %= 100;
- twentyfivecent.setText(new Integer(Total.intValue() / 25).toString());
- Total %= 25;
- tencent.setText(new Integer(Total.intValue() / 10).toString());
- Total %= 10;
- fivecent.setText(new Integer(Total.intValue() / 5).toString());
- Total %= 5;
- onecent.setText(new Integer(Total.intValue() / 1).toString());
- Total %= 1;
- /**
- * @param args the command line arguments
- */
- public static void main(String args[]) {
- /* Set the Nimbus look and feel */
- //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
- /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
- * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
- */
- try {
- for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
- if ("Nimbus".equals(info.getName())) {
- javax.swing.UIManager.setLookAndFeel(info.getClassName());
- break;
- }
- }
- } catch (ClassNotFoundException ex) {
- java.util.logging.Logger.getLogger(Changecalc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (InstantiationException ex) {
- java.util.logging.Logger.getLogger(Changecalc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (IllegalAccessException ex) {
- java.util.logging.Logger.getLogger(Changecalc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (javax.swing.UnsupportedLookAndFeelException ex) {
- java.util.logging.Logger.getLogger(Changecalc.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- }
- //</editor-fold>
- /* Create and display the form */
- java.awt.EventQueue.invokeLater(new Runnable() {
- public void run() {
- new Changecalc().setVisible(true);
- }
- });
- }
- // Variables declaration - do not modify
- private javax.swing.JTextField CashAmt;
- private javax.swing.JTextField ChngDue;
- private javax.swing.JTextField SaleAmt;
- private javax.swing.JTextField dollar;
- private javax.swing.JTextField five;
- private javax.swing.JTextField fivecent;
- private javax.swing.JButton jButton1;
- private javax.swing.JLabel jLabel1;
- private javax.swing.JLabel jLabel10;
- private javax.swing.JLabel jLabel2;
- private javax.swing.JLabel jLabel3;
- private javax.swing.JLabel jLabel4;
- private javax.swing.JLabel jLabel5;
- private javax.swing.JLabel jLabel6;
- private javax.swing.JLabel jLabel7;
- private javax.swing.JLabel jLabel8;
- private javax.swing.JLabel jLabel9;
- private javax.swing.JTextField onecent;
- private javax.swing.JTextField ten;
- private javax.swing.JTextField tencent;
- private javax.swing.JTextField twenty;
- private javax.swing.JTextField twentyfivecent;
- private javax.swing.JTextField two;
- // End of variables declaration
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement