Class Mortgage

java.lang.Object
  extended by Mortgage

public class Mortgage
extends java.lang.Object

Mortgage.java
Solution for CS 201 HW 1 problem 1
Program to calculate and print the monthly mortgage payment for a given principal, interest rate, and loan duration Documentation copied from sample documentation by Daniel Scharstein


Constructor Summary
Mortgage()
           
 
Method Summary
static void main(java.lang.String[] args)
          Main simply calls test method.
static double mortgage(double principal, double interest, double years)
          Calculates monthly mortgage from parameters.
static void print(double principal, double interest, double years)
          Prints one-line information about mortgage.
static void test()
          Prints information about mortgages for interest rates between 5 and 10 in 0.25 increments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mortgage

public Mortgage()
Method Detail

main

public static void main(java.lang.String[] args)
Main simply calls test method.


mortgage

public static double mortgage(double principal,
                              double interest,
                              double years)
Calculates monthly mortgage from parameters.

Parameters:
principal - the principal in dollars
interest - the interest in percent
years - the duration of the mortgage in years
Returns:
the monthly mortagage payment

print

public static void print(double principal,
                         double interest,
                         double years)
Prints one-line information about mortgage.

Parameters:
principal - the principal in dollars
interest - the interest in percent
years - the duration of the mortgage in years

test

public static void test()
Prints information about mortgages for interest rates between 5 and 10 in 0.25 increments.