Write a presentvaluecalculator class to calculate the


Practice with Computer Math

1) An annuity (sometimes called a reverse mortgage) is an account that yields a fixed payment every year until it is depleted. Typically, one makes a one-time deposit which then earns interest for a set number of years. Afterwards, a fixed amount is withdrawn (paid out) for a set number of years.

The initial deposit, called the present value of the annuity, is the amount that you would need to invest at a given interest rate so that the payments can be made.

The present value of an annuity (PVann) at the time of the first deposit can be calculated using the following formula:

presentValue = payment x (((1+i)n-1 - 1)/i)/((1+i)n-1 + 1)

where:

payment: periodic payment
i: periodic interest or compound rate
n: number of payments

What is the present value of an annuity that will pay out $10,000 in each of the next 20 years if the interest rate is 8 percent?

Write a PresentValueCalculator class to calculate the present value of an annuity for these values. Choose the appropriate date type for payment, i and n. Remember that you can use Math.pow(x, y) to calculate xy.

What is your program?

public class PresentValueCalculator
{
public static void main(String[] args)
{
}
}

2) Modify the program you created so that the user can provide the values for for payment, i and n through the console. Be sure to prompt the user for the appropriate input. The Scanner class has methods nextInt and nextDouble methods for converting user input to binary values for calculations.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Write a presentvaluecalculator class to calculate the
Reference No:- TGS02386552

Now Priced at $15 (50% Discount)

Recommended (90%)

Rated (4.3/5)