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

  Write the program using a for-loop and a break statement

Write a program that asks the user to enter a number that's positive and a multiple of 4. The user has three attempts to find such a number. Write the program using a for-loop and a ‘break' statement in the loop

  What is the output of this code sequence

What is the output of this code sequence

  Find what kind of output best shows off the operation

Find what kind of output best shows off the operation of these classes, and write a program that produces that kind of output.

  Write a java gui program that has eight tabs

I need to write a java gui program that has 8 tabs, General, Options, Customers, Contractors, Pools, Hot Tubs, Temp Calc, and Length Calc. Each pane needs an Exit button that will close only that pane.

  The goal is to create a project that would let a user

the goal is to create a project that would let a user compute area and perimeter of a polygon. restrict the type of

  Write a method, insertat that takes four parameters

Write a method, insertAt that takes four parameters

  Method to store the product of the two arrays in third array

Write a method to store the product of the two arrays in the third array

  Consider the game matrix

Consider the following game in matrix form with two players. Payoffs for the row player Izzy are indicated first in each cell, and payoffs for the column player Jack are second.

  Prepare a class called geometrycalculator

Calculates the area of a circle of a given radius and write a class called GeometryCalculator that includes the subsequent methods

  A program that reads a four-digit number from the keyb

Write a program that reads a four-digit number from the keyboard as a string and then converts it into decimal. For example, if the input is 1100, the output should be 12. Hint: Break the string into characters and then convert each character to a va..

  Write a method called negative sum

Write a method called negativeSum that accepts a Scanner reading input from a file containing a series of integers, and print a message to the console indicating whether the sum starting from the first number is ever negative

  Write a complete program which computes the sum

Write a complete program (actually complete the one on the exam) which computes the following sum: ( 100 / 1 ) + ( 99 / 2 ) + ( 98 / 3 ) + ( 97 / 4 ) + ... + ( 3 / 98 ) + ( 2 / 99 ) + ( 1 / 100 ) Use a FOR loop in your program (where indicated) to..

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