Skip to content

Instantly share code, notes, and snippets.

@mahnve
Created November 19, 2015 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mahnve/e69f226f80568e01511f to your computer and use it in GitHub Desktop.
Save mahnve/e69f226f80568e01511f to your computer and use it in GitHub Desktop.
class Arithmetic {
public double calculateInterest(int initialAmount, double interest, int years) {
double cumulativeInterest = Math.pow((1 + interest), years);
return cumulativeInterest * initialAmount;
}
public static void main(String args[]) {
Arithmetic arithmetic = new Arithmetic();
double sum = arithmetic.calculateInterest(Integer.parseInt(args[0]),
Double.parseDouble(args[1]),
Integer.parseInt(args[2]));
System.out.println(sum);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment