Question: Write a Java program called Lottery.java Description Assume a person wins the lottery and is given the choice of receiving a lump sum or annual

Write a Java program called Lottery.java
Description
Assume a person wins the lottery and is given the choice of receiving a lump sum or annual payments. Prompt the user to enter the lump sum amount (amtLump), the annual payment (pmt), the interest rate (r) in decimal (Eg. enter .05 instead of 5%) and the number of payments ( n ). Create a method called calcPV to calculate today's value of the annual payments (pv). Call the calcPV method from the main method using the parameters values given by the user (pmt, r, n) and store the return value into a double variable pv. Display amtLump, pv and a message indicating which option is better.
You are REQUIRED to use a method to calculate pv. Any submissions without the calcPV method will receive NO credit.
Sample runs and an Excel spreadsheet to test your calculations are attached. The formula to calculate pv is shown below:
pv=pmt(1r-1r(1+r)n)
pv : present value
pmt: annual payment
r : interest rate in decimals (e.g.5%=.05)
n : number of years
Write a Java program called Lottery.java

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!