.

Saturday, April 13, 2013

Mortgage Calculator week 5 Java II

/*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 key to continue ...n);System.in.read(); //read in}}break;case 2:loanAmount = 200000.00; // reset loan amountlineCount = 1; //reset line countmonthlyPayment = calculate(loanAmount, monthlyInt[1], loanTerm[1]) ;out.println(nYour monthly payment will be: + currency.format(monthlyPayment) + n);out.printf(%s%15s%20s%20sn, Payment#, Balance, Principle Paid, Interest Paid);while (lineCount <= loanTerm[1]*12 ){//Declares formula, displays the loan balance and interest paidinterestpaid = (loanAmount * (monthlyInt[1]/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 key to continue ...n);System.in.read(); //read in}}break;case 3:loanAmount = 200000.00; // reset loan amountlineCount = 1; //reset line countmonthlyPayment = calculate(loanAmount, monthlyInt[2], loanTerm[2]) ;out.println(nYour monthly payment will be: + currency.format(monthlyPayment) + n);out.

Ordercustompaper.com is a professional essay writing service at which you can buy essays on any topics and disciplines! All custom essays are written by professional writers!

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 key to continue ...n);System.in.read(); //read in}}break;}out.println();out.println();}else //choice 4 was selectedout.println(nThank You and come to see us again.n);} // block of while} // end of mainpublic static double calculate(double Amount, double MonthInt, int Term) // counting{double Monthly;Term = Term * 12;MonthInt = MonthInt / 100 / 12;Monthly = ( Amount * Math.pow((1 + MonthInt), Term) * MonthInt) /( Math.pow( (1 + MonthInt), Term ) - 1 ); depict Monthly;}private static void ShowMenu() // menu setup{out.println( M E N U);out.println(n);out.println(1. 7 years at interest rate 5.35%);out.println(2. 15 Years at interest rate 5.50%);out.println(3. 30 Years at interest rate 5.75%);out.println(4. End program n);out.print(nEnter your choice: );} // end function ShowMenu} // end of class

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, night club it on our website: Ordercustompaper.com



If you want to get a full essay, wisit our page: write my paper

No comments:

Post a Comment