
public class Mortgage
{
	
	public static void main(String[] argv) 
	{
		
		int loan;
		float rate;
		int term;
		
		//System.out.println(loan + "" + rate + "" + term);
		if(argv.length >= 3) {
			loan = Integer.parseInt(argv[0]);
			rate = Float.parseFloat(argv[1]);
			term = Integer.parseInt(argv[2]);
		}
		else {
			System.out.println("Incorrect number of arguments...");
			return;
		}
		
		
		float intRate = rate/1200;
		int numOfPmts = term*12;
		
		//Formula [P((1+R)^N)*R]/[((1+R)^N)-1]
		// P - Principle
		// R - Interest Rate per month in decimals
		// N - Number of payments
		double val = java.lang.Math.pow((1+intRate),numOfPmts);
		double mp = (loan*val*intRate)/(val-1);
		System.out.println("Monthly Payment: " + mp);
	}
	
	
}