InterviewSolution
| 1. |
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 userIf 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 :CourseFee Per QuarterPharmacy2000.00Architecture2500.00Arts & Design2300.00If 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 :(i) 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.(ii) When 'CLEAR' button is clicked, all the texfields, radiobuttons and checkbox should be cleared.(iii) When 'Exit' button is clicked the application should close. |
|
Answer» (i) Code when Calculate Charges button will be click: int Fee, con_amt; String Name = jTextField1.getText (); if (jRadioButton1. isSelected ( ) = = True) Fee = 2000; else if (jRadioButton2.isSelected () = = True) Fee = 2500; else if (jRadioButton3. isSelecled () = = True) Fee = 2300; else Fee = 0; jTextField2.setText (Fee) ; if (jCheckBox.isSelected () = = True) con_amt = (Fee * 7)/100; else con_amt = 0; jTextfield3.setText (con_amt) ; float Fee_paid; Fee_paid = Fee - con_amt; jTextField4.setText (Fee_paid) ; (ii) Code when Clear button will be click: jTextField1.setText (" "); jTextField2.setText (" "); jTextFieid3.setTex (" "); jTextField4.setTex (" "); jRadioButton1.setSelected (False); jRadioButton2.setSeiected (False) ; j RadioButton3.setSelected (FaIse) ; jCheckBox.setSelected (False) ; (iii) Code when Exit button will be Click : System.exit (0); |
|