Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2026 Crash Course
NEET 2026 Crash Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
3.1k views
in Computer by (75.3k points)

Mr. Rangaswami works at a Recreation Park as a system analyst. He has created the following GUI. When a group arrives at the Recreation Park, the number of people in the group and whether the group wants to enjoy the Water Park or not is entered. Entry fee is Rs 500 per person. The person can choose to play at Water park by selecting the checkbox. Rides of Water Park will cost Rs 250 extra per person.

Help him to write code for the following : (i) On the click of 'Calculate' button, textfield for 'Entry Fees' should display (Entry Fees per person) x (number of people). If 'Water Park' check box is selected, textfield for 'Water Park charges' should display Water (Park Charges per Person) x (Number of People). TextField for 'total Amount' should display sum of Entry Fees and Water Park charges for all the people in the group.

(ii) Write Java code to clear all Textboxes on the click of 'Clear' Button.

(iii) Write Java code to close the application on the click of 'Exit' Button.

1 Answer

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

(i) int wfee = 0, tfee = 0;

int nop = Integer.parseInt(JTextField1.getText());

int efee = nop * 500;

if(jCheckBox1.isSelected())

wfee = nop * 500;

tfee = efee * wfee;

j TextField2. setText(" " + efee);

jTextField3.setText("" + wfee);

jTextField4.se tText(" " + tfee);

(ii) JTextField1.setText(" ");

JTextField2.setText(" ") ;

JTextField3.setText(" ") ;

JTextField4.setText(" ") ;

(iii) System.exit(0);

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

...