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 |
I want my class to be developed in such a way that no other class (even derived class) can create its objects. Define how can I do so?
What is square root in java?
What is an object’s lock and which object’s have locks?
What are 3 boolean operators?
How to synchonise HashMap
What is basic concept of static in java ?
What is a default method?
Why is java not 100% pure oops?
. What are the differences between constructor and method of a class in Java?
Is integer immutable in java?
What is the purpose of interface?
Considering notepad/ie or any other thing as process, what will happen if you start notepad or ie 3 times? Where 3 processes are started or 3 threads are started?