Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

what is connection pooling with example?

3 Answers   Amdocs,


How do you check whether the list is empty or not in java?

0 Answers  


How the interruptible method gets implemented?

0 Answers  


What is the return type of read()?

3 Answers  


How to reduce flicking in animation?

3 Answers   TCS,


what is the volatile modifier for? : Java thread

0 Answers  


Explain the importance of finally over return statement?

0 Answers  


Difference between String & StringBuffer

16 Answers   IBM, Infosys, Tech Mahindra, Wipro,


Which are thin and thicK wrapper Class's in Java?

1 Answers  


Why multiple inheritance is not supported by java?

0 Answers  


What are loops in java?

2 Answers  


What is an escape character in java?

0 Answers  


Categories