All pastes #984750 Raw Edit

java

public text v1 · immutable
·published 2008-04-14 15:14 UTC
rendered paste body

public class BertIO {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// Declaring variables
		String custName;
		int price;
		int downPayment;
		int tradeIn;
		int months;
		double annualInterest;
		double interest;
		int loanAmt;
		double payment;
		
		// Assigning Values
		custName = "Ben Boswick";
		price = 20000;
		downPayment = 1000;
		tradeIn = 1500;
		months = 48;
		annualInterest = .075;
		
		// Calculations
		interest = annualInterest / 12;
		loanAmt = price - downPayment - tradeIn;
		payment = loanAmt/((1/interest) - (1 / (interest * Math.pow(1 + interest, months))));
		
		// Output
		System.out.println("The monthly payment for " + custName + " is $" + Math.round(payment));
	}

}