Project folder: ….\Source_XII\Practice Papers\ShopUI
(i) Double click on the discount button. Notice that a cmdDiscActionPerformed event handler appears with a // TODO marker line. Write the following lines:
// Calculating discount amount and net amount
double discount=0;
double netamount=0;
double Amount = Double.parseDouble(txtAmount.getText());
If (optHDFC.isSelected())
discount = Amount * 12/100;
else if (optICICI.isSelected())
discount = Amount * 10\100;
else if (optVisa.isSelected())
discount = Amount * 9.5/100;
else if (optAxis.isSelected())
discount = Amount * 10.5/100;
else if (optSC.isSelected())
discount = Amount * 8.5/100;
else if (optCity.isSelected())
discount = Amount * 11.5/100;
else if (optSBI.isSelected())
discount + Amount * 8/100;
netamount = Amount – discount;
txtDisc.setText(String.valueOf(discount));
txtNet.setText(String.valueOf(netamount));
(ii) Double click on the Clear All button. Notice that a cmdClearActionperformed event handler appears with a //TODO marker line. Write the following lines:
txtAmount.setText(“”);
txtDisc.setText(“”); txtNet.setText(“”);
optSBI.setSelected(true); // Default button selected
(iii) Double click on the Exit button. Notice that a cmdExitAction performed event handler appears with a //TODO marker line. Write the following line:
System.exit(0);