Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
3.9k views
in Computer by (75.2k points)

Mr. Ashish works as a programmer in "Universal Technologies Pvt. Ltd.". He has designed a Library software to generate the member type depending upon the membership type considering discount eligibility as well. A screenshot the same is shown below:

Help him in writing the code to do the following :

(i) After selecting appropriate Radio Button, when 'Check Fee' button is clicked, fee should be displayed in the respective text field according to the following criteria :

Membership Type Fee
Monthly 500
Quarterly 1000
Yearly 1500

(ii) After selecting appropriate Radio Button, when 'Check Discount button is clicked, appropriate discount should be displayed in the respective text field according to the following criteria :

Discount Eligibility Discount
Students 200
Other 100

(iii) When 'Calculate' button is clicked, Net Fee should be calculated and displayed in the respective text field as per the given formula :

Net Fee = Fee - Discount

(iv) When 'Clear All' button is clicked, All the text fields should be cleared.

1 Answer

+1 vote
by (69.0k points)
selected by
 
Best answer

(i) Code for 'Check Fee' button;

if (jRadioButton1.isSelected())

jTextField3.setText("500");

else if (jRadioButton2.isSelected())

jTextField3.setText("1000");

else if(RadioButton3.isSelected())

jTextField3.set Text("1500");

(ii) Code for 'Check Discount' button

if (jRadioButton4.isSelected())

jTextField4.setext("200") ;

else if(jRadioButton5.isSelected())

jTextField4.setText("100");

(iii) Code for 'Calculate' button

int fee = Integer.parseInt(jTextField3.getText());

int disc = Integer.parseInt(jTextField4.getText());

int net = fee-disc;

jTextField5.setText("' + net);

(iv) Code for 'Clear All' button

jTextField1.setText(" ") ;

jTextField2.setText(" ") ;

jTextField3.setText(" ") ;

jTextField4.setText(" ") ;

jTextField5.setText(" ") ;

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...