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
+1 vote
7.3k views
in Information Technology by (71.3k points)

Ms. Neelam works as a programmer in “Kidz Entertainment Zone”. She has designed a Registration Page to calculate the total fee of summer camp depending upon the number of activities selected by the user considering age eligibility as well. A screenshot of the same is shown below:

Help her in writing the code to do the following:

(i) After entering the age in the specified text field, when „Chk Eligibility‟ button is clicked, a dialogue box should be displayed with a message “Welcome” if age is in between 3-13 years else the program should be terminated after displaying the message “Sorry! You are either underage or overage!!”.

(ii) After selecting the desirable activities, total fee should be displayed in the specified text field on the click of “Proceed” button at the rate of Rs. 1000 per activity.

(iii) A discount of 20% is applicable if more than one activity is chosen by the user.

(iv) After clicking on the “Net Fee” button, Net Fee should be calculated and displayed in the respective text field as per the given formula:

NetFee = Fee – Discount

1 Answer

+2 votes
by (76.5k points)
selected by
 
Best answer

(i)

int age=Integer.parseInt(jTextField2.getText());

if(age>=3 && age<=13)

{

jOptionPane1.showMessageDialog(this, "Welcome");

}

else

{

jOptionPane1.showMessageDialog(this, "Sorry!You are either underage or overage!!");

System.exit(0);

}

(ii)

int count=0;

if(jCheckBox1.isSelected())

count++;

if(jCheckBox2.isSelected())

count++;

if(jCheckBox3.isSelected())

count++;

if(jCheckBox4.isSelected())

count++;

if(jCheckBox5.isSelected())

count++;

if(jCheckBox6.isSelected())

count++;

jTextField3.setText(""+(count*1000));

(iii)

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

int disc=0;

if(fee>1000)

disc=fee*20/100;

jTextField4.setText(""+(disc));

(iv)

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

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

jTextField5.setText(""+(fee-disc));

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

...