subject

It’s 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. Write a program to gauge the expected cost of an item in a specified number of years. 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. So far this is what I have, but I can't get it to run. import java. util. Scanner;import java. text. NumberFormat;/**Computes the estimated cost of an item after inflation*/public class Inflation {public static void main(String[] args) {// Make a Scanner to read data from the consoleScanner console = new Scanner(System. in);// Read in the current item cost, years, and inflation rateSystem. out. println("Enter cost of item:");double cost = console. nextDouble();System. out. println("Enter number of (whole) years until the item is purchased:");int years = console. nextInt();System. out. println("Enter the inflation rate as a percentage (e. g., 5.6):");double inflationRate = console. nextDouble();// Convert percent to fractional value, then compute the estimated// final cost// Make a NumberFormat for printing the final costNumberFormat moneyFormat = NumberFormat. getCurrencyInstance();System. out. println("The estimated final cost of the item will be " +moneyFormat. format(cost));}}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:30
What type of computer network ensures high security ?
Answers: 1
question
Computers and Technology, 23.06.2019 09:10
(328 inc. 448 ind. 480 in25. john has a collection of toy cars. he has 2 red cars, 4 blue cars, 4 black cars, and 6 yellowcars. what is the ratio of red cars to yellow cars? a. 1: 2b. 1: 3c. 1: 626. the net of a right triangular prism is shown below.
Answers: 2
question
Computers and Technology, 23.06.2019 22:30
Janice usually works on a particular workbook that contains all business related data. she decides to keep a backup of all the data in a separate workbook. she opens a new workbook to transfer the data. which option should she use to copy all the data from one workbook to another workbook?
Answers: 1
question
Computers and Technology, 24.06.2019 01:00
How can the temperature of a room be raised by 5degreesf?
Answers: 1
You know the right answer?
It’s difficult to make a budget that spans several years, because prices are not stable. If your com...
Questions
question
Mathematics, 10.06.2020 03:57
Questions on the website: 13722361