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
107 views
in Computer by (41.5k points)
closed by

Ms. Sharma works as a programmer in “ABC Car Rental Company” where she has designed a software to compute charges to be paid by the client. A screenshot of the same is shown below:

A client can take any car out of Deluxe/ SemiDeluxe/ Ordinary for rent. 

A client can also opt for services of a guide. Charges vary depending on the type of car opted. Charges of services of Guide are extra. 

Help Ms. Sharma in writing the code to do the following:

After selecting appropriate Radio Button and checkbox (if required), when ‘CALCULATE’ button is clicked, Amount, Guide Charges and Total Amount should be calculated and displayed in the respective text fields

Category of Car Amount (In Rs.)
Deluxe Car 1000 per day
Semi deluxe car 800 per day
Ordinary car 700 per day

Amount is obtained by multiplying per day charges of Car with number of days for which the car is taken. 

If ‘Guide Required’ checkbox is selected, Guide charges per day are Rs.500.00. 

Guide Charges is calculated as :Car required for No. of days * 500; 

Total Amount = Amount + Guide Charges

1 Answer

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

// Calculation of Amount 

if (jRadioButton1.isSelected()) 

jTextField3.setText("" + 1000* 

Integer.parseInt(jTextField2.getText())); 

if (jRadioButton2.isSelected() 

jTextField3.setText("" + 800* 

Integer.parseInt(jTextField2.getText())); 

if (jRadioButton3.isSelected()) 

jTextField3.setText("" + 700* 

Integer.parseInt(jTextField2.getText())); 

//Calculation of Guide Charges 

if(jCheckBox1.isSelected()) 

jTextField4.setText("" + 500* 

Integer.parseInt(jTextField2.getText())); 

//Total Amount 

jTextField5.setText("" + 

(Integer.parseInt(jTextField3.getText())+ 

Integer.parseInt(jTextField4.getText())));

(ii) When ‘CLEAR’ button is clicked, all the textfields and checkboxes should be cleared. 

jTextField1.setText(""); 

jTextField2.setText(""); 

jTextField3.setText(""); 

jTextField4.setText(""); 

jTextField5.setText(""); 

jTextField6.setText(“”); 

jCheckBox1.setSelected(false); 

(iii) When ‘CLOSE’ button is clicked, the application should close. 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

...