// package chapter6; /** * Title: Chapter 6, "Programming with Objects and Classes" * Description: Examples for Chapter 6 * Copyright: Copyright (c) 2000 * Company: Armstrong Atlantic State University * @author Y. Daniel Liang * @version 1.0 */ // TestMortgageClass.java: Demonstrate using the Mortgage class public class TestMortgageClass { /**Main method*/ public static void main(String[] args) { // Enter interest rate System.out.print( "Enter yearly interest rate, for example 8.25: "); double interestRate = MyInput.readDouble(); // Enter years System.out.print( "Enter number of years as an integer, for example 5: "); int year = MyInput.readInt(); // Enter loan amount System.out.print( "Enter loan amount, for example 120000.95: "); double loan = MyInput.readDouble(); // Create Mortgage object Mortgage m = new Mortgage(interestRate, year, loan); // Display results System.out.println("The monthly payment is " + m.monthlyPayment()); System.out.println("The total payment is " + m.totalPayment()); } }