Check03C - buffer = input.nextLine(); int yrs =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.util.Scanner; import; import type.lib.ToolBox; i public class Check03C { public static void main(String[] args) { Scanner input = new Scanner(; PrintStream output = System.out; P try { output.print("Mortgage amount: "); o String buffer = input.nextLine(); double mortgageAmt = Double.parseDouble(buffer); d output.print("Annual interest percent: "); o buffer = input.nextLine(); double yearlyInterestRate = Double.parseDouble(buffer); d output.print("Number of years: ");
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: buffer = input.nextLine(); int yrs = Integer.parseInt(buffer); i double monthlyPayment = ToolBox.mortgagePayment(mortgageAmt, yearlyInterestRate, yrs); final int MONTHS = 12; double totalMonthlyPayment = monthlyPayment * MONTHS * yrs; d output.printf("Monthly payment = %,.2f%n", monthlyPayment); output.printf("Total of all payments = %,.2f%n", totalMonthlyPayment); } catch (NumberFormatException ex) { } } }...
View Full Document

This note was uploaded on 09/16/2011 for the course CSE CSE 1020 taught by Professor Burton,ma during the Fall '10 term at York University.

Ask a homework question - tutors are online