In: Computer Science
This solution is to be written in JAVA
It is difficult to make a budget that spans several years, because prices are not stable. If your company needs 200 pencils per year, you cannot simply use this year’s price as the cost of pencils two years from now. Because of inflation, the cost is likely to be higher than it is today.
The program asks for the cost of the item, the number of years from now that the item will be purchased, and the rate of inflation. The program then outputs the estimated cost of the item after the specified period. Have the user enter the inflation rate as a percentage, such as 5.6 (percent). Your program should then convert the percent to a fraction, such as 0.056, and should use a loop to estimate the price adjusted for inflation.
The below is java code to calculate the cost price after certain year entered by user and at cartain inflation rate entered in fractional value :
TEST CASE #1
Please Enter the cost : 3000
Please enter the number of Years also : 8
Please enter the inflation rate also : 0.056
OUTPUT
The cost of Items is USD 3013.46 in 8 years.
TEST CASE #2
Please Enter the cost : 4000
Please enter the number of Years also : 12
Please enter the inflation rate also : 0.007
OUTPUT
The cost of Items is USD 4003.36 in 12 years.