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
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 |
What is the unit of plancks constant?
Can try statements be nested?
How do you check if a string is lexicographically in java?
what is the diff b/w arraylist and vector?
6 Answers Code Genesis, Genesis, Sprintine Labs,
Why is method overloading not possible by changing the return type in java?
Is arraylist ordered?
Infinite loop using while ?
What is map and hashmap? also tell the difference.
What is the need of transient variables in Java ?
What is difference between c++ and java ?
What is the public method modifier?
define polymorphism in java