Role of setter and getter in mortgage calculator

Assignment Help JAVA Programming
Reference no: EM13942165

My output display this: Mortgagecalculator@7ced01

The output should display Years: 30, Loan Amount $200000.00, Interest Rate: .0575, and Monthly Payment: Calculated by Math.POW. Then a list of loan balance and interest paid for each payment over the term of the loan should scroll off the screen, but need loops to display a partial list, hesitate and then display more of the list. Do not use a graphical user interface. Please insert comments in the program so I can understand the fixes.

The setter and getters must stay in MortgageCalculator.java and everything should output from main (Driver.java).

FILE: DRIVER.JAVA

import java.util.*;
/***Created on June 27, 2004, 5:07 PM
* Java Programming Project Workshop 3 -
* Problem statement - Create a driver for the Mortgage Calculator
* Scope - declare, initialize and set values and display mortgage calculator
* @author TERRY PARKER
*/
public class Driver {

/**
* @param args the command line arguments
*/
public static void main(String args[]){//The main part of Mortgage Calculator begins here
Mortgagecalculator mCalc;
mCalc = new Mortgagecalculator();
mCalc.setYears(30);
mCalc.setLoanAmount(200000.0);
mCalc.setInterestRate(.0575);
System.out.println(mCalc.toString());//Display the contents
}//end of group
}//closing bracket

FILE: MORTGAGE CALCULATOR.JAVA

/** mortgagecalculator.java
* Created on June 27, 2004, 5:07 PM
* Java Programming Project Workshop 2 -
* Problem statement - Create a Mortgage Calculator WITHOUT a graphical user interface
* Purpose - provide a user-friendly service to potential users for accurately planning mortgage and other types of loans
* Scope - The mortgage calculator must display the mortgage payment amount given the amount of the mortgage, the term of the mortgage, and the interest rate of the mortgage.
* This program must have hard code amount = 200,000, term= 30 years, and the interest rate = 5.75% in class driver.java
* Algorithm - standard loan calculation with fixed number of payments:
* Monthly Payment = Principal * (InterestRate / (1 - (InterestRate + 1) - 12 * Periods)
*
* Inputs:
* Principal = $200,000
* Interest Rate = 0.0575
* Periods = 360
*
* Output:
* Monthly Payment =
*
* @author TERRY PARKER
* NETBEANS IDE 3.6*/

public class Mortgagecalculator{

/** Creates a static mortgagecalculator */

public int years;//define variables
public double loanAmount;
public double interestRate;
public double monthlyPayment;

public void setYears(int inYears)//setter
{
years=inYears;
}//end set years

public int getYears()//getter
{
return years;
}//end get years

public void setLoanAmount(double inLoanAmount)//setter
{
loanAmount=inLoanAmount;
}//end set loanAmount

public double getLoanAmount()//getter
{
return loanAmount;
}//end get loanAmount

public void setInterestRate(double inInterestRate)//setter
{
interestRate=inInterestRate;
}//end set interestRate

public double getInterestRate()//getter
{
return interestRate;
}//end get interestrate

public void CalcMonthlyPayment()
{
monthlyPayment=loanAmount*Math.pow(1 + interestRate, years) * interestRate/(Math.pow(1 + interestRate, years) -1);
}

public String toString(double value){//strings are used to store text and variables
String retString = new String();
retString = "Values:";
retString = retString + " years=" + years;
retString = retString + " loanAmount=" + loanAmount;
retString = retString + " interestRate=" + interestRate;
retString = retString + " monthlyPayment=" + monthlyPayment;
return retString;
}//end group
}//closing bracket

Reference no: EM13942165

Questions Cloud

What is a marketing dashboard and how is it useful to market : What is a marketing dashboard and how is it useful to marketers? What types of performance measures do marketers use to assess marketing performance?
What approach might you use to validate your code : The other half of the satellite is and tip temperature for GS = 0 and an extremely large value of the thermal conductivity. Compare coated with a diffuse gray material with a2 = 0.3.
Brief description of the other functions of gis systems : A brief analysis of any GIS systems that exist in these regions. If none exists, then an evaluation of why not. A brief description of the other functions of GIS systems, in addition to law enforcement and policing.
Highlighting the factors affecting selection of materials : Define the term material handling,highlighting the factors affecting selection of materials handling devices and finally give the principles of materials handling.
Role of setter and getter in mortgage calculator : The setter and getters must stay in MortgageCalculator.java and everything should output from main (Driver.java).
Modelling in linear programming : Question 1: Modelling in Linear Programming The manager of a power station has to determine an operating policy for next week's power genera-tion. The station has been scheduled to generate a total of 100 gigawatt hours of power during the next we..
Why do we do this, and what problems can this cause : A big problem in T&D is that we often skip the needs assessment phase and jump right into training. Why do we do this, and what problems can this cause?
Determine the fraction of the checker pattern : Assume the satellite is isothermal and has no internal power dissipation. Determine the fraction F of the checker pattern required to maintain the satellite at 300 K.
Description of the current level of influence : A description of the context of the professional situation including your role in the organization. A description of the current level of influence. A description of the desired level of influence

Reviews

Write a Review

JAVA Programming Questions & Answers

  Structure named dog with a string field

Create a Structure named dog with a string field for the Dog's name. Create a Structure named Cat with a string field for the Cat's name. Write a program that declares one Dog and one Cat, and assign names to them. Write two overloaded functions n..

  Modify the java application using java netbeans ide

Modify the Java application using Java NetBeans IDE to meet these additional and changed business requirements

  Implement a distributed banking application

In the first part, you will implement a distributed banking application. The distributed bank has multiple branches. Every branch knows about all other branches.

  Program obtaining the new scriptdownload and save the

program obtaining the new scriptdownload and save the attached comment cgi mailer script form-mail2.pl to your servers

  Displays a drawing for the popular hangman game

Write a program that displays a drawing for the popular hangman game

  Problem 1 the queue adta queue is a fundamental abstract

problem 1. the queue adta queue is a fundamental abstract data type. it is an ordered collection of items in which the

  Implement an inheritance hierarchy based on the following

Implement an inheritance hierarchy based on the following specifications for Account class, Checking Account class, and Savings Account class Methods: processDeposit ( ) - accepts a single double parameter containing the deposit amount. Updates the ..

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Calculates the price of carpeting for rectangular rooms.

Once you have written these classes, use them in an application that asks the user to enter the dimensions of a room and the price per square foot of the desired carpeting. The application should display the total cost of the carpet.

  Write a java program to implement the finite field

Write a program called "GF2.java" to implement the finite field GF(p n ) where p is a prime number and n is a positive integer.  You also need to write four methods to realize "+", "-", "´", and "/".

  When are stubs & skeletons created for my ejb components

When are stubs & skeletons created for my EJB components? is it at development time, deployment time or run time?

  Application that simulates a cash register

Implement a graphical application that simulates a cash register. Provide a text field for the item price and two buttons for adding the item to the sale, one for taxable items and one for nontaxable items. In a text area, display the register tap..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd