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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  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.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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