public class PercentagePrinter public static void mainString args double

Public class percentageprinter public static void

This preview shows page 2 - 5 out of 7 pages.

Image of page 2
Q3. CalculationQ3.1 An annuity (sometimes called a reverse mortgage) is an account that yields a fixed payment every year until it is depleted. 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:PVann= PMT · ({[(1 + i)n - 1- 1] / i } / (1 + i)n - 1+ 1)where:PMT: periodic paymenti: periodic interest or compound raten: number of paymentsWhat 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 program to calculate the present value of an annuity for these values. Remember that you can use Math.pow(x, y)to calculate xyWhat is your program? . public class PercentagePrinter
Image of page 3
{ public static void main(String[] args) { double interest=.08; double payments=20; double periodic=10000; double one=(1+interest); double two=Math.pow(one,(payments-1)); double three=(two-1); double four=(three/interest); double five=(four/two); double six=(five+1); System.out.printf("%.2f", six*periodic); } } Q3.2 Modify the program you created in Q3.1 so that the user can provide the values for
Image of page 4
Image of page 5

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture