/*Programmer:SkySharkFile:MortgageCalculator5.javaDate:June 23,2008Purpose:To calculate and display the mortgage of the hard coded terms- 7 year at 5.35%- 15 year at 5.5%- 30 year at 5.75%*/ spell out java.text.NumberFormat; //for currency formatimport java.util.*; //for Scannerimport static java.lang.System.out;import java.io.*;public class MortgageCalculator5{public static void main (String [] args)throws IOException{double contributeAmount = 200000; //Loan amountdouble periodicalInt[] = {5.35, 5.50, 5.75}; // periodical refer ratedouble monthly retribution = 0; //Monthly paiddouble defrayments = 0;//Paymentdouble spare-time activitypaid = 0;//Interest paiddouble principalpaid = 0;//Principal paiddouble interest = 0;//Interestint loanTerm[] = {7, 15, 30}; //Term in year, arrayint contrastCount = 1;// Int line countNumberFormat currency = NumberFormat.getCurrencyInstance (); //for currency formatScanner sc = new Scanner(System.in); //for reading in a value from the mentionboardint superior = 1; //Int Choice// hold back if number 4 is picked or invalid entry, otherwise stretch broadcast fleck ( election != 4 ) //start loop for choice 4{do {if (choice > 4 || choice <= 0)out.println(Your selection is non an option. disport select again.);ShowMenu(); //set menutry {choice = sc.nextInt(); //read in a numeric value, a decimal or an integer} device (InputMismatchException e){out.println(nEntry is not valid! You should enter an integer from 1 to 4.);out.println(The program is terminated.n);System.exit(1);}} while ( choice < 0 || choice > 4 );if ( choice != 4 ){switch (choice) { // branch to an appropriate selectioncase 1:loanAmount = 200000.00; // reset loan amountlineCount = 1; //reset line countmonthlyPayment = calculate(loanAmount, monthlyInt[0], loanTerm[0]) ;out.println(nYour monthly payment will be: + currency.format (monthlyPayment) + n);out.printf(%s%15s%20s%20sn, Payment#, Balance, regulation gainful, Interest Paid);while (lineCount <= loanTerm[0]*12) // setup loop{//Declares formula, displays the loan balance and interest paidinterestpaid = (loanAmount * (monthlyInt[0]/ cytosine/12));principalpaid = (monthlyPayment - interestpaid);loanAmount = (loanAmount - principalpaid);System.out.printf(%3d%20s%20s%20sn, lineCount, currency.format(loanAmount),currency.format(principalpaid),currency.format(interestpaid));lineCount++;if ((lineCount % 21) == 0){System.out.println(nPress
printf(%s%15s%20s%20sn, Payment#, Balance, Principle Paid, Interest Paid);while (lineCount <= loanTerm[2]*12 ){//Declares formula, displays the loan balance and interest paidinterestpaid = (loanAmount * (monthlyInt[2]/100/12));principalpaid = (monthlyPayment - interestpaid);loanAmount = (loanAmount - principalpaid);System.out.printf(%3d%20s%20s%20sn, lineCount, currency.format(loanAmount),currency.format(principalpaid),currency.format(interestpaid));lineCount++;if ((lineCount % 21) == 0){System.out.println(nPress
This is not the workweek 5 assignment for PRG421 JAVA II class. This code does not reed data from a file nor does it provide a graph of amortized data.
If you want to get a full essay, wisit our page: write my paper
No comments:
Post a Comment