# Ms. Priya works as a programmer in “Avon Education” where she has designed a software

14 views

closed

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 textfield according to the following criterion :
 Course Fee per Quarter Pharmacy 2000.00 Architecture 2500.00 Arts & Design 2300.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:

1. 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.

2. When ‘CLEAR’ button is clicked, all the textfields, radiobuttons and checkbox should be cleared.

3. When ‘Exit1 button is clicked, the application should close.

+1 vote
by (52.3k points)
selected by

Here,

Name is stored in jTextField1

Fee Per Quarter is stored in jTextField2

Concession Amount is stored in jTextField3

Fee to be Paid is stored in jTextField4

(i) We need to double click at the ‘Calculate Charges’ button (jButtonl) and type the following code ;

int Fee_per_quar,

concession_amount ;

float fee_tobe_paid ;

String name = jTextFieldl. getText ( ) ;

if (jRadioButtonl. isSelected ( ) = =True)

Fee_per_quar = 2000 ;

else if (jRadioButton2. isSelectedO == True) Fee_per_quar = 2500 :

else if (jRadioButton3. is Selected ( ) == True)

Fee_per_quar = 2300 ;

else

Fee, per_quar = 0 ;

jTextField2. setText (Fee_per_quar) ;

if (jCheckBox. isSelected ( ) = =True)

concession_amount = (Fee__per_quar * 7) / 100 ;

else

concession_amount = 0 ;

JTextField3. setText

(concession_amount) ;

fee_tobe_paid = Fee_per_quar - concession_amount ;

jTextField4. setText (fee_tobe_paid) ;

(ii) We need to double click at the ‘Clear’ button (jButton2) and type the following code :

jTextFieldl. setText (" ") ;

jTextField2. setText (" ") ;

jTextField3. setText (" ") ;

jTextField4. setText (" ") ;

(iii) We need to double click at the ‘Exit’ button (jButton3) and type the following code:

System., exit (0) ;

+1 vote