There is a Banking application. It has 2 types of account,
Savings and Current. Write a method calculateInterest by
passing an ArrayList of these account objects and calculate
Interest accordingly. Write code for this situation



There is a Banking application. It has 2 types of account, Savings and Current. Write a method calc..

Answer / 94374

public class CalculateInterst {
public static double calculateInterest (List list){
double intrest = 0;
if(list != null && list.get(0).equals("SAVING")){
//Calculate interest for Saving Account and return it
intrest = 7.0;

}else if (list != null && list.get(1).equals("CURRENT")){
//Calculate interest for Saving Account and return it
intrest = 5.0;
}
return intrest;
}

public static void main(String[] args) {
List list = new ArrayList();
list.add("SAVING");
list.add("CURRENT");
calculateInterest(list);
}

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More Core Java Interview Questions

how to print hello world every second till i have pressed enter key ???

1 Answers   SAP Labs,


What is a void in java?

0 Answers  


How many unicode characters are there?

0 Answers  


What are the practical benefits, if any, of importing a specific class rather than an entire package (e.g. Import java.net.* Versus import java.net.socket)?

0 Answers  


How finally used under exception handling?

0 Answers  






Explain the role played by Java Virtual Machine in Java Programming?

1 Answers  


How do you get length in java?

0 Answers  


Which eclipse is best for java?

0 Answers  


What are benefits of java?

0 Answers  


where lives in jvm

5 Answers  


What is the difference between access specifiers and access modifiers in java? 16

0 Answers  


What is an empty string in css?

0 Answers  


Categories