InterviewSolution
Saved Bookmarks
| 1. |
Ms. Rakhi works in an International Bank as an IT Head. She designed a simple interest calculator program as shown below:The interest rate is given based on the account type as shown below :Account Typelnterest Rate %Saying4%Recurring Depowity6%Fixed Deposite8%(i) Write the code required for 'INTEREST RATE' button to display interest rate as per the above given criteria.(ii) Write the code required for 'SI' button to calculate and display 'simple Interest' based on the given formula' SI = (amount*interestrate* duration)/100;(iii) Write the code required for 'CLEAR ALL to clear all the textfields. |
|
Answer» (i) Correct code required for 'INTEREST RATE' button to display interest rate as per the above given criteria: if (R1.isSelected() = = true) T3.setText(" 4"); else if(R2.isSelected() = = true) T3.setText("6"); if(R3.isSelected() = =true) T3.setText("8"); (ii) Correct code required for 'SI' button double amt = Double.parseDouble(T2.getText()); double int_rate =Double.parseDouble(T3.getText()); int year = Integer.parseInt(T4.getText()); double si = (amt*int_rate*year)/100; T5.setText(" " + si); (iii) t1.setText(" "); t2.setText(" "); t3.setText(" "); t4.setText(" "); t5.setText(" "); |
|