Program_9 - p = Console.nextInt(); System.out.println();

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.io.*; import java.text.*; import java.math.*; import java.lang.*; import java.util.Scanner; import java.util.*; //Jeremy Debruce //11/21/07 //Professor Campbell / public class Program_9 { public static void main(String[] args) { //variables double i,d1,m,t; int p,d; // purpose of the program System.out.println("****************************************************** **"); System.out.println("*The Purpose of this program is to Compute the Monthly *"); System.out.println("*Payment for a $45,000 loan with varying interest rates*"); System.out.println("* using Control Statements and output statements *"); System.out.println("* *"); System.out.println("****************************************************** **"); System.out.println(); // Scanner Scanner Console = new Scanner(System.in); System.out.println("Please Enter the Principal Amount.press enter");
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: p = Console.nextInt(); System.out.println(); System.out.println("****************************************************** *"); System.out.println("Principal Interest Duration Monthly Payment"); System.out.println("****************************************************** *"); System.out.printf("%5s", p); //Loop for(i = 12; i <= 16; i = i + .25) { //Interest Rate formatting if(i == 12) System.out.printf("%15.2f",i); else System.out.printf("%20.2f",i); for(d = 15; d <= 30; d = d + 5)//Loop 2 { //Equations d1 = (i * .01) * (p / 12); t = 1 - (Math.pow((((i * .01) / 12) + 1),(-12 * d))); // Monthly Payment m= d1 / t; //Formatting if(d == 15) System.out.printf("%12s %17.2f %n", d, m); else System.out.printf("%32s %17.2f %n", d, m); } System.out.println(); } } }...
View Full Document

Page1 / 2

Program_9 - p = Console.nextInt(); System.out.println();

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online