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
1.1k views
in Computer by (75.3k points)

People who wish to send flowers to their near and dear ones, contact 'Fragrance Florist'. Ms. Sharma works as a programmer in "Fragrance Florist" where she has designed a software to compute charges to be paid by the customer. A screenshot of the same is shown below:

(i) A customer orders for one type of flowers out of Red Rose/OrchidAellow Rose.

(ii) A "Special Customer" gets a 50.00 discount on Amount.

(iii) Name, Phone Number Flower ordered, whether customer is a Special customer, Number of Stems is input by the user.

(iv) Amount, Discount (if any), Amount to pay are calculated and displayed by the program.

Amount is calculated using the following criterion :

Flower Price per Stem (in Rs)
Red Rose 15 per stem
Orchid 60 per stem
Yellow Rose 20 per stem

(i) Amount is obtained by multiplying per Stem charges with number of stems bought.

(ii) If 'Special Customer' checkbox is selected, discount of Rs 50.00 is given on Amount.

Amount to Pay = Amount - Discount

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

(i) After selecting appropriate Radio Button and checkbox (if Spl Customer), when 'Calculate' button is clicked, AMOUNT, DISCOUNT (IF ANY) and AMOUNT TO pay should be calculated and displayed in the respective text fields.

(ii) When 'CLEAR button is clicked, all text fields, Radio buttons and checkbox should be cleared.

(iii) When 'CLOSE' button is clicked, the application should close.

1 Answer

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

(i) float dis;

int amt, int noofstems = Integer.parseInt(jTextField3.gettext());

if (jRadioButton1.isselected())

amt =15 * noofstems;

else if (jRadioButton2.isselected())

amt = 60 * noofstems;

else if(jRadioButton3.isselected())

amt = 0;

jTextField4.setText(" " + amt);

if(jcheokBox1.isselected())

jTextField5.setText("50.00");

dis = 50.00;

}

float amountPay = amt - dis;

jTextField6.setText(" "); jTextField2.setText (" ");

jTextField3.setText(" "); jTextField4.setText (" ");

j TextFietd5.setText(" " ); jTextField6.setText (" ") ;

jRadioButton1.setSelected (false);

jRadioButton2.setSelected (false);

jRadioButton3.setSelected (false);

jRadioButton1.setSelected (false);

Note : NULL in place of " " should also be accepted

(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

...