InterviewSolution
Saved Bookmarks
| 1. |
Ms. Angela works as a programmer in a Bus Tour Company named "Heritage Experiences". Groups of people come and reserve seats. There are 3 stopovers for the bus. First stop is at Alwar, second at Jaipur, third at Udaipur. A group may choose any one destination out of Alwar, Jaipur and Udaipur.Ms. Angela has designed a software to compute charges to be paid by the entire Soup. A screenshot of the same is shown below :A group can opt for one destination out of Alwar/Jaipur/Udaipur. If the group is "Frequent Traveller Group", the group gets a10% discount on Total charges.Help Ms. Angela in writing the code to do the following:(i) After selecting appropriate Radio Button and checkbox (if required), when 'Calculate Charges' button is clicked, 'Total Charges', 'Discount Amount', 'Amount to Pay' should be calculated and displayed in the respective text fields. The Charges per person for various destinations are as follows :DestinationAmount (in Rs)Alwar200.00 per personJaipur500.00 per personUdaipur900.00 per person'Total Charges' is obtained by multiplying 'Number of People in Group' with Amount Per Person.If 'Frequent Traveller Group' checkbox is selected. 'Discount Amount' is calculated as 10% of 'Total Charges'. Otherwise 'Discount Amount' is 0.'Amount to Pay' is calculated as :Amount to Pay = Total Charges - Discount Amount.(ii) When 'CLEAR' button is clicked, all the textfields, radio button and checkbox should be cleared.(iii) When 'EXIT' button is clicked, the application should close. |
|
Answer» (i) Code: float f; if(alwar.isSelected() == true) { f = 200.00; } else if(jaipur.isSelected() = = true) { f = 500.00; } else { f = 900.00; } totalcharges.settext((noofpersons.gettext())*f); if(ftgroup.isSelected = = true) { discamount = ((totalcharges.gettext() *10)/100); } amountpay.settext(totalcharges.gettext()- discamount.gettext()); (ii) organization.settext(" "); noofpersons.settext(" "); alwar.Selected : false; jaipur.selected = false; udaipur.Selected : false; ftgroup.Selected = false; totalcharges.settext(" " ); discamount.settext(" "); amountpay.settext(" " ); (iii) System.exit(0); |
|