Privacy Policy Terms Of Use. Copyright © 2006-2010 Java Tutorials and Examples.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
- /*
- * Write a program to calculate simple interest for given amount, interest rate and duration.
- * Program should take principal amount, duration and rate of interest using command line arguments.
- *
- */
- class SimpleInterest
- {
- public static void main(String[] args){
- float principal ,rateOfInterest ,interest;
- int noOfYears;
- principal = Float.valueOf(args[0]).floatValue();
- noOfYears = Integer.parseInt(args[1]);
- rateOfInterest = Float.valueOf(args[2]).floatValue();
- interest = (principal * rateOfInterest * noOfYears)/100;
- System.out.println("Interest is " + interest);
- }
- }

Post new comment