I'm having issues with the code i made for a Amortization chart.Calculations Work but cant figure out how to set it to make a chart displaying the total amounts owed and a monthly and yearly basis.
import java.util.*;
import java.lang.Math.*;
import java.text.DecimalFormat;
public class testCSCI112Assignment2{
static Scanner console = new Scanner(System.in);
public static void main(String[] args){
DecimalFormat df = new DecimalFormat("0.00");
double dblr; //rate
double dbli; //interest per month
double dbll; //loan amount
double dblt; //years
int intm; //# payments per year
double dblR; //periodic payment
double dblu; //Unpaid loan balance
double dblk; //# payments made
int inty;
//input
System.out.println("What is the Loan Amount:$");
dbll = console.nextDouble();
System.out.println("What is starting Year?");
inty = console.nextInt();
System.out.println("What is the interest rate(decimal Form:");
dblr = console.nextDouble();
System.out.println("What is the length of the loan(Years):");
dblt = console.nextDouble();
System.out.println("Payments Per Year:");
intm = console.nextInt();
System.out.println("Number of payments made");
dblk = console.nextDouble();
//calc
dbli = (dblr/intm);
dblR = ((dbll * dbli) / (1 - Math.pow((1 + dbli), (-intm * dblt))));
Formatter fmt = new Formatter();
fmt.format("%.2f", dblR);
System.out.println("Your periodic payment is $" + fmt);
//Loan Balance
do{
dblu = (dblR * (1 - Math.pow((1 + dbli), (-(intm * dblt - dblk))))) / dbli;
}
while (dblk < 0);
Formatter fmt2 = new Formatter();
fmt2.format("%.2f", dblu);
System.out.println("Your remaining balance is $" + fmt2);
for(int year = inty; year <= dblt; year ++){
System.out.println("\nYear \tPayment \tPrincipal \tInterest \tBalance");
System.out.println("****************************************************************");
System.out.println("::: ::: :::");
for (int payment = 1; payment <= intm; payment++){
}
}
}
}
thank you for your time.

New Topic/Question
Reply




MultiQuote




|