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 |
How do you remove an element from an arraylist in java?
Is linked list a linear or non-linear data structure?
0 Answers Akamai Technologies,
What is the declaration statement?
What does a void function return?
What are operators and its types?
How define set in java?
What is the internal implementation of set in java?
why marker interfaces are there in java
what is singleton in java?
Define locale.
Why declare Main() method as a static in java ?
How is object created in java?