Avon Education Informatics Practices 2018

Ms Priya works as a programmer in “Avon Education” where she has designed a software to compute fee charges to be paid by the students. A screenshot of the same is shown below:

Name of the student is entered by the user. Any one course out of Pharmacy, Architecture and Arts & Design is chosen by the user. If the student is eligible for Concession, the required checkbox is selected by the user.

Based on the course selected, Fee Per Quarter is displayed in the appropriate text field according to the following criterion:

CourseFee Per Quarter
Pharmacy2000.00
Architecture2500.00
Arts & Design2300.00

If the student is eligible for concession, a concession of 7% of fee per quarter is calculated as the concession amount, otherwise concession amount is 0. Fee to be paid is the fee per quarter with the concession amount (if any) deducted from it.

Help Ms Priya in writing the code to do the following:

  • When ‘Calculate Charges’ button is clicked, ‘Fee per Quarter’, ‘Concession Amount’, ‘Fee to be paid’ should be calculated and displayed in the respective text fields.
  • When ‘Clear’ button is clicked, all the text fields, radio buttons and checkbox should be cleared.
  • When ‘Exit’ button is clicked, the application should close.
private void buttonChargesActionPerformed(java.awt.event.ActionEvent evt) {
    double fee = 0.0;
    double concession = 0.0;
    double pay = 0.0;
    if(radioPharmacy.isSelected())
        fee = 2000.0;
    else if(radioArchitecture.isSelected())
        fee = 2500.0;
    else if(radioArts.isSelected())
        fee = 2300.0;
    if(checkConcession.isSelected())
        concession = Math.ceil(7.0 / 100 * fee);
    pay = fee - concession;
    textFieldFee.setText(Double.toString(fee));
    textFieldConcession.setText(Double.toString(concession));
    textFieldPaid.setText(Double.toString(pay));
}                                             

private void buttonClearActionPerformed(java.awt.event.ActionEvent evt) {    
    textFieldName.setText("");
    checkConcession.setSelected(false);
    textFieldFee.setText("");
    textFieldConcession.setText("");
    textFieldPaid.setText("");
    buttonGroup1.clearSelection();
        
}                                           

private void buttonExitActionPerformed(java.awt.event.ActionEvent evt) {             
    System.exit(0);
}

Leave a Reply

%d bloggers like this: