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 JDK? Mention the variants of JDK?
Define a java class.
Is string is a data type?
I have 2 objects inside one object(vector). how can i serialize one of them. I dont want to serialize the second one
What is the exact difference in between Unicast and Multicast object? Where will it be used?
What is class forname used for?
Tell us something about different types of casting?
Which variables are stored in stack?
What is the minimum and maximum length of an identifier?
Which is a valid identifier?
what is the constructor and how many types of constructors are used in java?
how many ways we can serialize the java object?