SlideShare a Scribd company logo
MortgageCalculator.javaMortgageCalculator.java/**
* The mortgage calculator program will provide the following:
* It will provide a monthly property tax amount
* It will provide a monthly insurance premium amount
* It will provide a monthly principle and interest payment
* Finally it will provide the total monthly mortgage payment
*/
import java.util.Scanner;
/**
* @author Nathan Christensen
* @version 1.0 Java Assn 4
*/
publicclassMortgagCalculator
{
publicstaticvoid main(String[] args)
{
String name;
String zip;
double value;
double rate;
Scanner sc =newScanner(System.in);
programFunction();
MortgageLoan loan =newMortgageLoan();
programFunction();
System.out.print("Please enter home buyers last name: ");
name = sc.next();
System.out.print("Please enter home buyers zip code: ");
zip = sc.next();
System.out.print("Please enter your home value: ");
value = sc.nextDouble();
System.out.print("Please enter the annual interest rate: ");
rate = sc.nextDouble();
System.out.println("n");
loan.setIdentifier(name, zip);
loan.setValue(value);
loan.setRate(rate);
loan.setAmount();
System.out.println("n");
System.out.println("n");
display(loan);
calculate(loan);
}
publicstaticvoid programFunction()
{
System.out.println("This is a loan calculatorn"
+"Calculations are to be done in the following stepsn");
}
publicstaticvoid display(MortgageLoan loan){
System.out.println("Loan Detailsn");
System.out.println(" Loan identifier: "+ loan.getI
dentifier());
System.out.printf (" Loan amount: %10.2fn", loa
n.getLoan());
System.out.println(" Loan length: "+ loan.getYe
ars()+" years");
System.out.printf (" Annual percentage rate: %10.3f%%
n", loan.getRate());
System.out.println("n");
}
publicstaticvoid calculate(MortgageLoan loan){
double taxes;
double premium;
double payment;
double total;
taxes = loan.calculateMonthlyPropertyTax();
premium = loan.calculateMonthlyInsurancePremium();
payment = loan.calculateMonthlyPrincipleInterestLoan();
total = taxes + premium + payment;
System.out.println("Monthly Mortgage Paymentn");
System.out.printf (" Monthly Tax Payment: %10.2fn",
taxes);
System.out.printf (" Monthly Insurance Premium: %10.2f
n", premium);
System.out.printf (" Monthly Principle and Interest: %10.2fn
", payment);
System.out.println(" ----------");
System.out.printf (" Total Monthly Mortgage Payment: %10.2
fn", total);
System.out.println();
}
}
MortgageLoan.javaMortgageLoan.java/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
publicclassMortgageLoan
{
privateString identifier;
privatedouble value;
privatedouble downpayment;
privatedouble loan;
privateint years;
privatedouble rate;
publicMortgageLoan()
{
identifier ="";
value =0.0;
loan =0.0;
rate =0.0;
downpayment =10;
years =30;
}
publicvoid setIdentifier(String lastName,String zip)
{
String id = lastName.substring(0,4)+ zip.substring(zip.length()-
3);
id = id.toUpperCase();
identifier = id;
}
publicvoid setValue(double v){
value = v;
}
publicvoid setAmount(){
loan = value -(value * downpayment /100);
}
publicvoid setRate(double r)
{
rate = r;
}
publicString getIdentifier(){
return identifier;
}
publicdouble getLoan(){
return loan;
}
publicint getYears(){
return years;
}
publicdouble getRate(){
return rate;
}
publicdouble calculateMonthlyPropertyTax()
{
finaldouble ASSESS_RATE =0.85;
finaldouble TAXED_RATE =0.0063;
finaldouble ADMIN_FEE =35.00;
double homeAssessedValue;
double percentageOfHomeAssessedValue;
double monthlyPropertyTaxPayment;
homeAssessedValue = ASSESS_RATE * value;
percentageOfHomeAssessedValue = TAXED_RATE * hom
eAssessedValue + ADMIN_FEE;
monthlyPropertyTaxPayment = percentageOfHomeAssessed
Value /12;
return monthlyPropertyTaxPayment;
}
publicdouble calculateMonthlyInsurancePremium()
{
finaldouble PREMIUM_RATE =0.0049;
double annualInsurancePremium;
double monthlyInsurancePremium;
annualInsurancePremium = PREMIUM_RATE * value;
monthlyInsurancePremium = annualInsurancePremium /12;
returnMath.round(monthlyInsurancePremium);
}
publicdouble calculateMonthlyPrincipleInterestLoan()
{
finalint LOAN_LENGTH = years *12;
double monthlyInterestRate;
double factor;
double monthlyLoanPayment;
monthlyInterestRate = rate /100/12;
factor =Math.exp(LOAN_LENGTH *Math.log(1+ monthlyI
nterestRate));
monthlyLoanPayment = factor * monthlyInterestRate * loa
n /(factor -1);
return monthlyLoanPayment;
}
}
©Regis University, All Rights Reserved
Unauthorized distribution (including uploading to any non-
Regis Internet website) violates copyright law
Regis University CC&IS
CS210 Introduction to Programming
Java Programming Assignment 5: Objects and Decisions
Your last Alice program implemented decision making.
This assignment will apply the same concepts to Java, starting
with the code from your last Java program
(Java Assn 4), which implemented objects. The Java Assn 4
program ran all of the code sequentially.
Decision statements will now be used to run some of the
statements conditionally, by implementing at
least one of each of the following conditional programming
constructs: if statement or if/else statement,
multiple alternative if statement, nested if statement, and switch
statement.
WARNING: Again, this assignment will be more challenging
than the previous assignments, so
make sure to start early and allocate enough time to complete it,
including time you might need
to seek any necessary help.
Problem Summary
Suppose you wanted to further modify your Mortgage
Calculator, to make it more versatile. Starting
with Java programming assignment 4, you could add the
following features:
down payment percentage amount
to use.
-year
and a 30-year loan, to allow the user
to compare them.
set the interest rate for a mortgage.
o The mortgage company sets interest rates using the following
chart, based on the length of
a loan and the loan type.
o Loans up to $417,000 are called “conforming” loans. Loans
over that amount are
considered “jumbo” loans, and have different interest rates.
Interest Rate Chart Conforming Loans Jumbo Loans
30-year fixed 4.5% 4.125%
20-year fixed 3.85% 3.5%
Overview of Program
This program will still contain two classes, in two separate files
within your project:
geLoan class to define the data fields and
methods for a MortgageLoan
object, containing:
o Seven data field definitions for a MortgageLoan object
o Two constructor methods to create a MortgageLoan object
(one constructor without
parameters and one constructor with parameters).
o Six setter methods to set the values for six of the data fields
o An instance method to compute the monthly property tax.
o An instance method to compute the monthly insurance
premium.
o An instance method to compute the monthly principle and
interest loan payment.
o An instance method to display one loan’s information.
o An instance method to calculate and display a loan’s payment
information.
©Regis University, All Rights Reserved
Unauthorized distribution (including uploading to any non-
Regis Internet website) violates copyright law
two methods, containing:
o A static method to display a description of what the program
will do.
o A main method to display the program description, to read the
inputs from the user, to
create two MortgageLoan objects, and to call the other methods
to display loan and
payment information.
Program Requirements
Modify the program you wrote for Java Assignment 4, as
follows:
1. Within the MortgageLoan class:
o char loan type (will store ‘C’ for conforming or ‘J’ for jumbo)
o Define a local constant and set it to hold the upper limit for
conforming loan amounts.
o Set the loan type data field to ‘C’ for Conforming.
Then use an if statement to decide whether to re-set the data
field to ‘J’ for Jumbo,
depending upon the value stored in the loan amount data field.
o The setter will now only have one parameter, the last name
(will no longer use the zip code).
o The loan identifier field will be created using the first 6
letters (uppercased) of the last name.
append Xs to the end of the name,
so that there will be 6 letters total.
o Modify the body of the setter method to:
loan identifier’s
String length of 6.
(“XXXXXX”).
identifier, WITHOUT using brute
force.
o NOTE: You will need to check the length of the last name
BEFORE trying to extract letters
and then use a decision statement to decide which letters to
extract. Otherwise the program
may crash when there are less than 6 letters in the last name.
o The user will no longer enter the annual interest rate. Instead,
the setter will use a nested
if statement to set the annual interest rate data field, according
to the chart on the
previous page.
is a conforming loan, decide which rate to use
based rates for
conforming loans and the loan length data field.
loans and the loan
length data field.
©Regis University, All Rights Reserved
Unauthorized distribution (including uploading to any non-
Regis Internet website) violates copyright law
o Add a char input parameter, to pass in the user’s letter choice
of down payment.
o Use a switch statement to set the down payment percentage as
follows:
N (no down payment) – set the percentage to 0
L (low down payment) – set the percentage to 10%
S (standard down payment) – set the percentage to 20%
H (high down payment) – set the percentage to 30%
If the parameter contains any other letter, set the percentage to
0, and display an error
message telling the user that since his/her choice was invalid,
no down payment will be
applied.
ortgageLoan type
object.
The new constructor with have four parameters:
o the home buyer’s last name (String)
o the home value
o the down payment percentage choice (char)
o the loan length in years
The constructor will:
o Assign values to the home value and loan length data fields,
using the constructor
parameters for the values.
o Call the modified setters for the loan identifier and the down
payment percent, using the
constructor parameter as the setter arguments.
o Call the original setter for the loan amount (no arguments –
uses data fields values)
o Call the new setter for the loan type (no arguments – uses data
field values).
o Call the modified setter for the loan annual interest rate (no
arguments – uses data field
values.
NOTE: The original getters for this class will no longer be
necessary. All data fields will be
accessed via the display instance methods.
that it will decide what insurance
rate to use.
o Instead of using a constant insurance rate (delete the defined
constant), use a multiple
alternative if statement to decide what rate to use, based on the
down payment percentage,
and store the value into a variable.
ess, use a rate of 0.52%
assignment 3 (0.49%).
be two instance methods within the
MortgageLoan class, as described below.
o Note that neither of these methods will require parameters,
because the data fields can be
accessed directly.
©Regis University, All Rights Reserved
Unauthorized distribution (including uploading to any non-
Regis Internet website) violates copyright law
o Display only the loan identifier, the loan amount and loan
type.
statement to display the loan type.
shown below:
,
will:
o Call each of the calculation instance methods (to compute the
monthly taxes, insurance,
and loan principle & interest payments) using this so that the
calculations methods
calls will use the same object as the
calcAndDisplayPaymentInfo method.
method, and then
compute the total monthly mortgage payment.
o Modify the display of the loan length, annual interest, and
monthly mortgage payment
parts and total, to look like this:
places and be followed by a
percent sign (%).
ld be displayed to 2 decimal places,
lined up on the decimal
points.
also line up with the loan
identifier, amount, and type displayed from the displayLoanInfo
method.
After creating the above two instance methods, be sure to delete
the static display methods from the
MortgagCalculator class.
Loan length 20 years
Annual interest rate 3.500%
Monthly Taxes 226.04
Monthly Insurance 217.00
Monthly Principle & Interest 2609.82
---------
Total Monthly Mortgage Payment 3052.86
Loan identifier JOHNSO
Loan amount 450000.00
Loan type jumbo
©Regis University, All Rights Reserved
Unauthorized distribution (including uploading to any non-
Regis Internet website) violates copyright law
2. Within the original class MortgageCalculator class that
contains the main method:
o Still display the program description, as in Java Assignment
4.
o Modify what data is read from the user.
, as in Java Assignment 4.
the user.
Inputs below), as follows:
the user.
Sample Inputs
o Use the new constructor to create TWO objects of the
MortgageLoan class type.
Both objects will have the same buyer’s last name, home value,
and down payment choice.
But they will have different loan lengths.
years.
loan length of
30 years.
o Display a couple of lines to separate the input from the
output.
o Using one of the objects, call the displayLoanInfo instance
method to get and display the
loan identifier, the loan amount, and loan type.
o Display a “Loan Option 1:” header. Then call the
calcAndDisplayPaymentInfo instance
method with the first MortgageLoan object.
o Display a “Loan Option 2:” header. Then call the
calcAndDisplayPaymentInfo instance
method with the second MortgageLoan object.
(see sample output on next page)
WARNING:
As with your previous Java programs, the objects, classes, and
methods must be implemented exactly
as specified above, or you will lose a significant number of
points.
Please enter the home buyer’s last name: Poe
Please enter the home value: 250000
Down Payment Options:
N - Nothing down
L - Low down payment
S - Standard down payment
H - High down payment
Please enter your choice: S
©Regis University, All Rights Reserved
Unauthorized distribution (including uploading to any non-
Regis Internet website) violates copyright law
Sample Output
Coding Standards
The program must also follow the CS210 Coding Standards
from Content section 6.10.
You must include the following comments:
o Comments at the top of the file, above the main class,
describing what the class does
the version of the
code (e.g. @version 1.0, Java Assn 3)
o Comments at the top of each method, above the method
header, describing what the
method does (only this method – do not refer to actions of any
other methods)
and return value.
Delete any default comments supplied by the IDE that you did
not use.
Debugging and Testing
Run, test, and debug your Java program, until you confirm that
all of the decision control structures work.
Be sure to test your program with different inputs to make sure
it provides correct results.
Loan identifier POEXXX
Loan amount 200000.00
Loan type conforming
Loan Option 1:
Loan length 20 years
Annual interest rate 3.850%
Monthly Taxes 114.48
Monthly Insurance 102.00
Monthly Principle & Interest 1196.21
----------
Total Monthly Mortgage Payment 1412.69
Loan Option 2:
Loan length 30 years
Annual interest rate 4.500%
Monthly Taxes 114.48
Monthly Insurance 102.00
Monthly Principle & Interest 1013.37
----------
Total Monthly Mortgage Payment 1229.85
©Regis University, All Rights Reserved
Unauthorized distribution (including uploading to any non-
Regis Internet website) violates copyright law
Submission
This programming assignment is due by midnight of the date
listed in the Course Assignments by
Week.
Again, you will submit a single zip file containing all of the
files in your project.
o Highlight the project name.
o Click on File from the top menu, and select Export Project.
o Select To ZIP
o Name your export file in the following format:
<lastname>Assn<x>.zip
For example:
SmithAssn5.zip
NOTE: Save this zip file to some other directory, not your
project directory.
submission folder (located under
the Assignments/Dropbox tab in the online course).
o Warning: Only NetBeans export files will be accepted.
Do not use any other kind of archive or zip utility.
Grading
Your program will be graded using the rubric that is linked on
the same assignment page from which this
program requirements file was downloaded.
WARNING:
Programs submitted more than 5 days past the due date will not
be accepted,
and will receive a grade of 0.

More Related Content

Similar to MortgageCalculator.javaMortgageCalculator.java  The mortga.docx

AIRBNB DATA WAREHOUSE & GRAPH DATABASE
AIRBNB DATA WAREHOUSE & GRAPH DATABASEAIRBNB DATA WAREHOUSE & GRAPH DATABASE
AIRBNB DATA WAREHOUSE & GRAPH DATABASE
Sagar Deogirkar
 
PRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdfPRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdf
jaymaraltamera
 
1-What are the opportunities and threats that could impact the org
1-What are the opportunities and threats that could impact the org1-What are the opportunities and threats that could impact the org
1-What are the opportunities and threats that could impact the org
AbbyWhyte974
 
1-What are the opportunities and threats that could impact the org
1-What are the opportunities and threats that could impact the org1-What are the opportunities and threats that could impact the org
1-What are the opportunities and threats that could impact the org
MartineMccracken314
 
Hi,I have updated the code as per your requirement. Highlighted th.pdf
Hi,I have updated the code as per your requirement. Highlighted th.pdfHi,I have updated the code as per your requirement. Highlighted th.pdf
Hi,I have updated the code as per your requirement. Highlighted th.pdf
annaindustries
 
Pointers
PointersPointers
Dimensionality & Dimensions of Hyperion Planning
Dimensionality & Dimensions of Hyperion PlanningDimensionality & Dimensions of Hyperion Planning
Dimensionality & Dimensions of Hyperion Planning
epmvirtual.com
 
INT213 Project Report: Income Tax Calculator
INT213 Project Report: Income Tax CalculatorINT213 Project Report: Income Tax Calculator
INT213 Project Report: Income Tax Calculator
Qazi Maaz Arshad
 
The java program MortgagePayment that prompts user to .pdf
   The java program MortgagePayment that prompts  user to .pdf   The java program MortgagePayment that prompts  user to .pdf
The java program MortgagePayment that prompts user to .pdf
annamalaiagencies
 
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
gilbertkpeters11344
 
HS2021 Database Design and UseWeek 2 - 2020 Tutorial
        HS2021 Database Design and UseWeek 2 - 2020 Tutorial        HS2021 Database Design and UseWeek 2 - 2020 Tutorial
HS2021 Database Design and UseWeek 2 - 2020 Tutorial
troutmanboris
 
HS2021 Database Design and UseWeek 2 - 2020 Tutorial.docx
        HS2021 Database Design and UseWeek 2 - 2020 Tutorial.docx        HS2021 Database Design and UseWeek 2 - 2020 Tutorial.docx
HS2021 Database Design and UseWeek 2 - 2020 Tutorial.docx
ShiraPrater50
 
Hyperion step by step guide
Hyperion step by step guideHyperion step by step guide
Hyperion step by step guide
chalasani kamesh
 

Similar to MortgageCalculator.javaMortgageCalculator.java  The mortga.docx (13)

AIRBNB DATA WAREHOUSE & GRAPH DATABASE
AIRBNB DATA WAREHOUSE & GRAPH DATABASEAIRBNB DATA WAREHOUSE & GRAPH DATABASE
AIRBNB DATA WAREHOUSE & GRAPH DATABASE
 
PRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdfPRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdf
 
1-What are the opportunities and threats that could impact the org
1-What are the opportunities and threats that could impact the org1-What are the opportunities and threats that could impact the org
1-What are the opportunities and threats that could impact the org
 
1-What are the opportunities and threats that could impact the org
1-What are the opportunities and threats that could impact the org1-What are the opportunities and threats that could impact the org
1-What are the opportunities and threats that could impact the org
 
Hi,I have updated the code as per your requirement. Highlighted th.pdf
Hi,I have updated the code as per your requirement. Highlighted th.pdfHi,I have updated the code as per your requirement. Highlighted th.pdf
Hi,I have updated the code as per your requirement. Highlighted th.pdf
 
Pointers
PointersPointers
Pointers
 
Dimensionality & Dimensions of Hyperion Planning
Dimensionality & Dimensions of Hyperion PlanningDimensionality & Dimensions of Hyperion Planning
Dimensionality & Dimensions of Hyperion Planning
 
INT213 Project Report: Income Tax Calculator
INT213 Project Report: Income Tax CalculatorINT213 Project Report: Income Tax Calculator
INT213 Project Report: Income Tax Calculator
 
The java program MortgagePayment that prompts user to .pdf
   The java program MortgagePayment that prompts  user to .pdf   The java program MortgagePayment that prompts  user to .pdf
The java program MortgagePayment that prompts user to .pdf
 
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
 
HS2021 Database Design and UseWeek 2 - 2020 Tutorial
        HS2021 Database Design and UseWeek 2 - 2020 Tutorial        HS2021 Database Design and UseWeek 2 - 2020 Tutorial
HS2021 Database Design and UseWeek 2 - 2020 Tutorial
 
HS2021 Database Design and UseWeek 2 - 2020 Tutorial.docx
        HS2021 Database Design and UseWeek 2 - 2020 Tutorial.docx        HS2021 Database Design and UseWeek 2 - 2020 Tutorial.docx
HS2021 Database Design and UseWeek 2 - 2020 Tutorial.docx
 
Hyperion step by step guide
Hyperion step by step guideHyperion step by step guide
Hyperion step by step guide
 

More from gilpinleeanna

Name 1. The table shows the number of days per week, x, that 100.docx
Name 1. The table shows the number of days per week, x, that 100.docxName 1. The table shows the number of days per week, x, that 100.docx
Name 1. The table shows the number of days per week, x, that 100.docx
gilpinleeanna
 
Name _____________________Date ________________________ESL.docx
Name  _____________________Date  ________________________ESL.docxName  _____________________Date  ________________________ESL.docx
Name _____________________Date ________________________ESL.docx
gilpinleeanna
 
Name Bijapur Fort Year 1599 Location Bijapur city.docx
Name Bijapur Fort Year 1599 Location Bijapur city.docxName Bijapur Fort Year 1599 Location Bijapur city.docx
Name Bijapur Fort Year 1599 Location Bijapur city.docx
gilpinleeanna
 
Name _______________________________ (Ex2 rework) CHM 33.docx
Name  _______________________________ (Ex2 rework) CHM 33.docxName  _______________________________ (Ex2 rework) CHM 33.docx
Name _______________________________ (Ex2 rework) CHM 33.docx
gilpinleeanna
 
Name 1 Should Transportation Security Officers Be A.docx
Name 1 Should Transportation Security Officers Be A.docxName 1 Should Transportation Security Officers Be A.docx
Name 1 Should Transportation Security Officers Be A.docx
gilpinleeanna
 
Name Don’t ForgetDate UNIT 3 TEST(The direct.docx
Name   Don’t ForgetDate       UNIT 3 TEST(The direct.docxName   Don’t ForgetDate       UNIT 3 TEST(The direct.docx
Name Don’t ForgetDate UNIT 3 TEST(The direct.docx
gilpinleeanna
 
Name Add name hereConcept Matching From Disease to Treatmen.docx
Name  Add name hereConcept Matching From Disease to Treatmen.docxName  Add name hereConcept Matching From Disease to Treatmen.docx
Name Add name hereConcept Matching From Disease to Treatmen.docx
gilpinleeanna
 
Name Abdulla AlsuwaidiITA 160Uncle VanyaMan has been en.docx
Name Abdulla AlsuwaidiITA 160Uncle VanyaMan has been en.docxName Abdulla AlsuwaidiITA 160Uncle VanyaMan has been en.docx
Name Abdulla AlsuwaidiITA 160Uncle VanyaMan has been en.docx
gilpinleeanna
 
Name Add name hereHIM 2214 Module 6 Medical Record Abstractin.docx
Name  Add name hereHIM 2214 Module 6 Medical Record Abstractin.docxName  Add name hereHIM 2214 Module 6 Medical Record Abstractin.docx
Name Add name hereHIM 2214 Module 6 Medical Record Abstractin.docx
gilpinleeanna
 
Name Sophocles, AntigoneMain Characters Antigone, Cre.docx
Name    Sophocles, AntigoneMain Characters Antigone, Cre.docxName    Sophocles, AntigoneMain Characters Antigone, Cre.docx
Name Sophocles, AntigoneMain Characters Antigone, Cre.docx
gilpinleeanna
 
N4455 Nursing Leadership and ManagementWeek 3 Assignment 1.docx
N4455 Nursing Leadership and ManagementWeek 3 Assignment 1.docxN4455 Nursing Leadership and ManagementWeek 3 Assignment 1.docx
N4455 Nursing Leadership and ManagementWeek 3 Assignment 1.docx
gilpinleeanna
 
Name Habitable Zones – Student GuideExercisesPlease r.docx
Name  Habitable Zones – Student GuideExercisesPlease r.docxName  Habitable Zones – Student GuideExercisesPlease r.docx
Name Habitable Zones – Student GuideExercisesPlease r.docx
gilpinleeanna
 
Name Class Date SKILL ACTIVITY Giving an Eff.docx
Name    Class    Date   SKILL ACTIVITY Giving an Eff.docxName    Class    Date   SKILL ACTIVITY Giving an Eff.docx
Name Class Date SKILL ACTIVITY Giving an Eff.docx
gilpinleeanna
 
Name Speech Title I. Intro A) Atten.docx
Name  Speech Title    I. Intro  A) Atten.docxName  Speech Title    I. Intro  A) Atten.docx
Name Speech Title I. Intro A) Atten.docx
gilpinleeanna
 
n engl j med 352;16www.nejm.org april 21, .docx
n engl j med 352;16www.nejm.org april 21, .docxn engl j med 352;16www.nejm.org april 21, .docx
n engl j med 352;16www.nejm.org april 21, .docx
gilpinleeanna
 
Name Class Date HUMR 211 Spr.docx
Name     Class     Date    HUMR 211 Spr.docxName     Class     Date    HUMR 211 Spr.docx
Name Class Date HUMR 211 Spr.docx
gilpinleeanna
 
NAME ----------------------------------- CLASS -------------- .docx
NAME ----------------------------------- CLASS -------------- .docxNAME ----------------------------------- CLASS -------------- .docx
NAME ----------------------------------- CLASS -------------- .docx
gilpinleeanna
 
NAHQ Code of Ethics and Standards of Practice ©Copyright 2011 .docx
NAHQ Code of Ethics and Standards of Practice ©Copyright 2011 .docxNAHQ Code of Ethics and Standards of Practice ©Copyright 2011 .docx
NAHQ Code of Ethics and Standards of Practice ©Copyright 2011 .docx
gilpinleeanna
 
Name Understanding by Design (UbD) TemplateStage 1—Desir.docx
Name  Understanding by Design (UbD) TemplateStage 1—Desir.docxName  Understanding by Design (UbD) TemplateStage 1—Desir.docx
Name Understanding by Design (UbD) TemplateStage 1—Desir.docx
gilpinleeanna
 
Name MUS108 Music Cultures of the World .docx
Name              MUS108 Music Cultures of the World              .docxName              MUS108 Music Cultures of the World              .docx
Name MUS108 Music Cultures of the World .docx
gilpinleeanna
 

More from gilpinleeanna (20)

Name 1. The table shows the number of days per week, x, that 100.docx
Name 1. The table shows the number of days per week, x, that 100.docxName 1. The table shows the number of days per week, x, that 100.docx
Name 1. The table shows the number of days per week, x, that 100.docx
 
Name _____________________Date ________________________ESL.docx
Name  _____________________Date  ________________________ESL.docxName  _____________________Date  ________________________ESL.docx
Name _____________________Date ________________________ESL.docx
 
Name Bijapur Fort Year 1599 Location Bijapur city.docx
Name Bijapur Fort Year 1599 Location Bijapur city.docxName Bijapur Fort Year 1599 Location Bijapur city.docx
Name Bijapur Fort Year 1599 Location Bijapur city.docx
 
Name _______________________________ (Ex2 rework) CHM 33.docx
Name  _______________________________ (Ex2 rework) CHM 33.docxName  _______________________________ (Ex2 rework) CHM 33.docx
Name _______________________________ (Ex2 rework) CHM 33.docx
 
Name 1 Should Transportation Security Officers Be A.docx
Name 1 Should Transportation Security Officers Be A.docxName 1 Should Transportation Security Officers Be A.docx
Name 1 Should Transportation Security Officers Be A.docx
 
Name Don’t ForgetDate UNIT 3 TEST(The direct.docx
Name   Don’t ForgetDate       UNIT 3 TEST(The direct.docxName   Don’t ForgetDate       UNIT 3 TEST(The direct.docx
Name Don’t ForgetDate UNIT 3 TEST(The direct.docx
 
Name Add name hereConcept Matching From Disease to Treatmen.docx
Name  Add name hereConcept Matching From Disease to Treatmen.docxName  Add name hereConcept Matching From Disease to Treatmen.docx
Name Add name hereConcept Matching From Disease to Treatmen.docx
 
Name Abdulla AlsuwaidiITA 160Uncle VanyaMan has been en.docx
Name Abdulla AlsuwaidiITA 160Uncle VanyaMan has been en.docxName Abdulla AlsuwaidiITA 160Uncle VanyaMan has been en.docx
Name Abdulla AlsuwaidiITA 160Uncle VanyaMan has been en.docx
 
Name Add name hereHIM 2214 Module 6 Medical Record Abstractin.docx
Name  Add name hereHIM 2214 Module 6 Medical Record Abstractin.docxName  Add name hereHIM 2214 Module 6 Medical Record Abstractin.docx
Name Add name hereHIM 2214 Module 6 Medical Record Abstractin.docx
 
Name Sophocles, AntigoneMain Characters Antigone, Cre.docx
Name    Sophocles, AntigoneMain Characters Antigone, Cre.docxName    Sophocles, AntigoneMain Characters Antigone, Cre.docx
Name Sophocles, AntigoneMain Characters Antigone, Cre.docx
 
N4455 Nursing Leadership and ManagementWeek 3 Assignment 1.docx
N4455 Nursing Leadership and ManagementWeek 3 Assignment 1.docxN4455 Nursing Leadership and ManagementWeek 3 Assignment 1.docx
N4455 Nursing Leadership and ManagementWeek 3 Assignment 1.docx
 
Name Habitable Zones – Student GuideExercisesPlease r.docx
Name  Habitable Zones – Student GuideExercisesPlease r.docxName  Habitable Zones – Student GuideExercisesPlease r.docx
Name Habitable Zones – Student GuideExercisesPlease r.docx
 
Name Class Date SKILL ACTIVITY Giving an Eff.docx
Name    Class    Date   SKILL ACTIVITY Giving an Eff.docxName    Class    Date   SKILL ACTIVITY Giving an Eff.docx
Name Class Date SKILL ACTIVITY Giving an Eff.docx
 
Name Speech Title I. Intro A) Atten.docx
Name  Speech Title    I. Intro  A) Atten.docxName  Speech Title    I. Intro  A) Atten.docx
Name Speech Title I. Intro A) Atten.docx
 
n engl j med 352;16www.nejm.org april 21, .docx
n engl j med 352;16www.nejm.org april 21, .docxn engl j med 352;16www.nejm.org april 21, .docx
n engl j med 352;16www.nejm.org april 21, .docx
 
Name Class Date HUMR 211 Spr.docx
Name     Class     Date    HUMR 211 Spr.docxName     Class     Date    HUMR 211 Spr.docx
Name Class Date HUMR 211 Spr.docx
 
NAME ----------------------------------- CLASS -------------- .docx
NAME ----------------------------------- CLASS -------------- .docxNAME ----------------------------------- CLASS -------------- .docx
NAME ----------------------------------- CLASS -------------- .docx
 
NAHQ Code of Ethics and Standards of Practice ©Copyright 2011 .docx
NAHQ Code of Ethics and Standards of Practice ©Copyright 2011 .docxNAHQ Code of Ethics and Standards of Practice ©Copyright 2011 .docx
NAHQ Code of Ethics and Standards of Practice ©Copyright 2011 .docx
 
Name Understanding by Design (UbD) TemplateStage 1—Desir.docx
Name  Understanding by Design (UbD) TemplateStage 1—Desir.docxName  Understanding by Design (UbD) TemplateStage 1—Desir.docx
Name Understanding by Design (UbD) TemplateStage 1—Desir.docx
 
Name MUS108 Music Cultures of the World .docx
Name              MUS108 Music Cultures of the World              .docxName              MUS108 Music Cultures of the World              .docx
Name MUS108 Music Cultures of the World .docx
 

Recently uploaded

The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 

Recently uploaded (20)

The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 

MortgageCalculator.javaMortgageCalculator.java  The mortga.docx

  • 1. MortgageCalculator.javaMortgageCalculator.java/** * The mortgage calculator program will provide the following: * It will provide a monthly property tax amount * It will provide a monthly insurance premium amount * It will provide a monthly principle and interest payment * Finally it will provide the total monthly mortgage payment */ import java.util.Scanner; /** * @author Nathan Christensen * @version 1.0 Java Assn 4 */ publicclassMortgagCalculator { publicstaticvoid main(String[] args) { String name; String zip; double value; double rate; Scanner sc =newScanner(System.in); programFunction(); MortgageLoan loan =newMortgageLoan(); programFunction();
  • 2. System.out.print("Please enter home buyers last name: "); name = sc.next(); System.out.print("Please enter home buyers zip code: "); zip = sc.next(); System.out.print("Please enter your home value: "); value = sc.nextDouble(); System.out.print("Please enter the annual interest rate: "); rate = sc.nextDouble(); System.out.println("n"); loan.setIdentifier(name, zip); loan.setValue(value); loan.setRate(rate); loan.setAmount(); System.out.println("n"); System.out.println("n"); display(loan); calculate(loan); } publicstaticvoid programFunction() { System.out.println("This is a loan calculatorn" +"Calculations are to be done in the following stepsn"); } publicstaticvoid display(MortgageLoan loan){ System.out.println("Loan Detailsn");
  • 3. System.out.println(" Loan identifier: "+ loan.getI dentifier()); System.out.printf (" Loan amount: %10.2fn", loa n.getLoan()); System.out.println(" Loan length: "+ loan.getYe ars()+" years"); System.out.printf (" Annual percentage rate: %10.3f%% n", loan.getRate()); System.out.println("n"); } publicstaticvoid calculate(MortgageLoan loan){ double taxes; double premium; double payment; double total; taxes = loan.calculateMonthlyPropertyTax(); premium = loan.calculateMonthlyInsurancePremium(); payment = loan.calculateMonthlyPrincipleInterestLoan(); total = taxes + premium + payment; System.out.println("Monthly Mortgage Paymentn"); System.out.printf (" Monthly Tax Payment: %10.2fn", taxes); System.out.printf (" Monthly Insurance Premium: %10.2f n", premium); System.out.printf (" Monthly Principle and Interest: %10.2fn ", payment); System.out.println(" ----------"); System.out.printf (" Total Monthly Mortgage Payment: %10.2 fn", total); System.out.println(); }
  • 4. } MortgageLoan.javaMortgageLoan.java/* * To change this template, choose Tools | Templates * and open the template in the editor. */ publicclassMortgageLoan { privateString identifier; privatedouble value; privatedouble downpayment; privatedouble loan; privateint years; privatedouble rate; publicMortgageLoan() { identifier =""; value =0.0; loan =0.0; rate =0.0; downpayment =10; years =30; } publicvoid setIdentifier(String lastName,String zip) { String id = lastName.substring(0,4)+ zip.substring(zip.length()- 3); id = id.toUpperCase();
  • 5. identifier = id; } publicvoid setValue(double v){ value = v; } publicvoid setAmount(){ loan = value -(value * downpayment /100); } publicvoid setRate(double r) { rate = r; } publicString getIdentifier(){ return identifier; } publicdouble getLoan(){ return loan; } publicint getYears(){ return years; } publicdouble getRate(){ return rate; } publicdouble calculateMonthlyPropertyTax() { finaldouble ASSESS_RATE =0.85;
  • 6. finaldouble TAXED_RATE =0.0063; finaldouble ADMIN_FEE =35.00; double homeAssessedValue; double percentageOfHomeAssessedValue; double monthlyPropertyTaxPayment; homeAssessedValue = ASSESS_RATE * value; percentageOfHomeAssessedValue = TAXED_RATE * hom eAssessedValue + ADMIN_FEE; monthlyPropertyTaxPayment = percentageOfHomeAssessed Value /12; return monthlyPropertyTaxPayment; } publicdouble calculateMonthlyInsurancePremium() { finaldouble PREMIUM_RATE =0.0049; double annualInsurancePremium; double monthlyInsurancePremium; annualInsurancePremium = PREMIUM_RATE * value; monthlyInsurancePremium = annualInsurancePremium /12; returnMath.round(monthlyInsurancePremium); } publicdouble calculateMonthlyPrincipleInterestLoan() { finalint LOAN_LENGTH = years *12; double monthlyInterestRate; double factor; double monthlyLoanPayment; monthlyInterestRate = rate /100/12;
  • 7. factor =Math.exp(LOAN_LENGTH *Math.log(1+ monthlyI nterestRate)); monthlyLoanPayment = factor * monthlyInterestRate * loa n /(factor -1); return monthlyLoanPayment; } } ©Regis University, All Rights Reserved Unauthorized distribution (including uploading to any non- Regis Internet website) violates copyright law Regis University CC&IS CS210 Introduction to Programming Java Programming Assignment 5: Objects and Decisions Your last Alice program implemented decision making. This assignment will apply the same concepts to Java, starting with the code from your last Java program (Java Assn 4), which implemented objects. The Java Assn 4 program ran all of the code sequentially. Decision statements will now be used to run some of the statements conditionally, by implementing at
  • 8. least one of each of the following conditional programming constructs: if statement or if/else statement, multiple alternative if statement, nested if statement, and switch statement. WARNING: Again, this assignment will be more challenging than the previous assignments, so make sure to start early and allocate enough time to complete it, including time you might need to seek any necessary help. Problem Summary Suppose you wanted to further modify your Mortgage Calculator, to make it more versatile. Starting with Java programming assignment 4, you could add the following features: down payment percentage amount to use. -year and a 30-year loan, to allow the user to compare them. set the interest rate for a mortgage. o The mortgage company sets interest rates using the following
  • 9. chart, based on the length of a loan and the loan type. o Loans up to $417,000 are called “conforming” loans. Loans over that amount are considered “jumbo” loans, and have different interest rates. Interest Rate Chart Conforming Loans Jumbo Loans 30-year fixed 4.5% 4.125% 20-year fixed 3.85% 3.5% Overview of Program This program will still contain two classes, in two separate files within your project: geLoan class to define the data fields and methods for a MortgageLoan object, containing: o Seven data field definitions for a MortgageLoan object o Two constructor methods to create a MortgageLoan object (one constructor without parameters and one constructor with parameters). o Six setter methods to set the values for six of the data fields o An instance method to compute the monthly property tax. o An instance method to compute the monthly insurance premium.
  • 10. o An instance method to compute the monthly principle and interest loan payment. o An instance method to display one loan’s information. o An instance method to calculate and display a loan’s payment information. ©Regis University, All Rights Reserved Unauthorized distribution (including uploading to any non- Regis Internet website) violates copyright law two methods, containing: o A static method to display a description of what the program will do. o A main method to display the program description, to read the inputs from the user, to create two MortgageLoan objects, and to call the other methods to display loan and payment information. Program Requirements Modify the program you wrote for Java Assignment 4, as follows: 1. Within the MortgageLoan class:
  • 11. o char loan type (will store ‘C’ for conforming or ‘J’ for jumbo) o Define a local constant and set it to hold the upper limit for conforming loan amounts. o Set the loan type data field to ‘C’ for Conforming. Then use an if statement to decide whether to re-set the data field to ‘J’ for Jumbo, depending upon the value stored in the loan amount data field. o The setter will now only have one parameter, the last name (will no longer use the zip code). o The loan identifier field will be created using the first 6 letters (uppercased) of the last name. append Xs to the end of the name, so that there will be 6 letters total. o Modify the body of the setter method to: loan identifier’s String length of 6. (“XXXXXX”).
  • 12. identifier, WITHOUT using brute force. o NOTE: You will need to check the length of the last name BEFORE trying to extract letters and then use a decision statement to decide which letters to extract. Otherwise the program may crash when there are less than 6 letters in the last name. o The user will no longer enter the annual interest rate. Instead, the setter will use a nested if statement to set the annual interest rate data field, according to the chart on the previous page. is a conforming loan, decide which rate to use based rates for conforming loans and the loan length data field. loans and the loan length data field. ©Regis University, All Rights Reserved Unauthorized distribution (including uploading to any non-
  • 13. Regis Internet website) violates copyright law o Add a char input parameter, to pass in the user’s letter choice of down payment. o Use a switch statement to set the down payment percentage as follows: N (no down payment) – set the percentage to 0 L (low down payment) – set the percentage to 10% S (standard down payment) – set the percentage to 20% H (high down payment) – set the percentage to 30% If the parameter contains any other letter, set the percentage to 0, and display an error message telling the user that since his/her choice was invalid, no down payment will be applied. ortgageLoan type object. The new constructor with have four parameters: o the home buyer’s last name (String) o the home value
  • 14. o the down payment percentage choice (char) o the loan length in years The constructor will: o Assign values to the home value and loan length data fields, using the constructor parameters for the values. o Call the modified setters for the loan identifier and the down payment percent, using the constructor parameter as the setter arguments. o Call the original setter for the loan amount (no arguments – uses data fields values) o Call the new setter for the loan type (no arguments – uses data field values). o Call the modified setter for the loan annual interest rate (no arguments – uses data field values. NOTE: The original getters for this class will no longer be necessary. All data fields will be accessed via the display instance methods. that it will decide what insurance rate to use. o Instead of using a constant insurance rate (delete the defined constant), use a multiple alternative if statement to decide what rate to use, based on the
  • 15. down payment percentage, and store the value into a variable. ess, use a rate of 0.52% assignment 3 (0.49%). be two instance methods within the MortgageLoan class, as described below. o Note that neither of these methods will require parameters, because the data fields can be accessed directly. ©Regis University, All Rights Reserved Unauthorized distribution (including uploading to any non- Regis Internet website) violates copyright law o Display only the loan identifier, the loan amount and loan type. statement to display the loan type.
  • 16. shown below: , will: o Call each of the calculation instance methods (to compute the monthly taxes, insurance, and loan principle & interest payments) using this so that the calculations methods calls will use the same object as the calcAndDisplayPaymentInfo method. method, and then compute the total monthly mortgage payment. o Modify the display of the loan length, annual interest, and monthly mortgage payment parts and total, to look like this:
  • 17. places and be followed by a percent sign (%). ld be displayed to 2 decimal places, lined up on the decimal points. also line up with the loan identifier, amount, and type displayed from the displayLoanInfo method. After creating the above two instance methods, be sure to delete the static display methods from the MortgagCalculator class. Loan length 20 years Annual interest rate 3.500% Monthly Taxes 226.04 Monthly Insurance 217.00 Monthly Principle & Interest 2609.82 --------- Total Monthly Mortgage Payment 3052.86
  • 18. Loan identifier JOHNSO Loan amount 450000.00 Loan type jumbo ©Regis University, All Rights Reserved Unauthorized distribution (including uploading to any non- Regis Internet website) violates copyright law 2. Within the original class MortgageCalculator class that contains the main method: o Still display the program description, as in Java Assignment 4. o Modify what data is read from the user. , as in Java Assignment 4. the user. Inputs below), as follows:
  • 19. the user. Sample Inputs o Use the new constructor to create TWO objects of the MortgageLoan class type. Both objects will have the same buyer’s last name, home value, and down payment choice. But they will have different loan lengths. years. loan length of 30 years. o Display a couple of lines to separate the input from the output. o Using one of the objects, call the displayLoanInfo instance method to get and display the loan identifier, the loan amount, and loan type. o Display a “Loan Option 1:” header. Then call the
  • 20. calcAndDisplayPaymentInfo instance method with the first MortgageLoan object. o Display a “Loan Option 2:” header. Then call the calcAndDisplayPaymentInfo instance method with the second MortgageLoan object. (see sample output on next page) WARNING: As with your previous Java programs, the objects, classes, and methods must be implemented exactly as specified above, or you will lose a significant number of points. Please enter the home buyer’s last name: Poe Please enter the home value: 250000 Down Payment Options: N - Nothing down L - Low down payment S - Standard down payment H - High down payment Please enter your choice: S
  • 21. ©Regis University, All Rights Reserved Unauthorized distribution (including uploading to any non- Regis Internet website) violates copyright law Sample Output Coding Standards The program must also follow the CS210 Coding Standards from Content section 6.10. You must include the following comments: o Comments at the top of the file, above the main class, describing what the class does
  • 22. the version of the code (e.g. @version 1.0, Java Assn 3) o Comments at the top of each method, above the method header, describing what the method does (only this method – do not refer to actions of any other methods) and return value. Delete any default comments supplied by the IDE that you did not use. Debugging and Testing Run, test, and debug your Java program, until you confirm that all of the decision control structures work. Be sure to test your program with different inputs to make sure it provides correct results. Loan identifier POEXXX Loan amount 200000.00 Loan type conforming Loan Option 1: Loan length 20 years
  • 23. Annual interest rate 3.850% Monthly Taxes 114.48 Monthly Insurance 102.00 Monthly Principle & Interest 1196.21 ---------- Total Monthly Mortgage Payment 1412.69 Loan Option 2: Loan length 30 years Annual interest rate 4.500% Monthly Taxes 114.48 Monthly Insurance 102.00 Monthly Principle & Interest 1013.37 ---------- Total Monthly Mortgage Payment 1229.85 ©Regis University, All Rights Reserved Unauthorized distribution (including uploading to any non- Regis Internet website) violates copyright law
  • 24. Submission This programming assignment is due by midnight of the date listed in the Course Assignments by Week. Again, you will submit a single zip file containing all of the files in your project. o Highlight the project name. o Click on File from the top menu, and select Export Project. o Select To ZIP o Name your export file in the following format: <lastname>Assn<x>.zip For example: SmithAssn5.zip NOTE: Save this zip file to some other directory, not your project directory. submission folder (located under the Assignments/Dropbox tab in the online course).
  • 25. o Warning: Only NetBeans export files will be accepted. Do not use any other kind of archive or zip utility. Grading Your program will be graded using the rubric that is linked on the same assignment page from which this program requirements file was downloaded. WARNING: Programs submitted more than 5 days past the due date will not be accepted, and will receive a grade of 0.