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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 24.06.2019 08:30, ladybuggirl400
@josethesolis i need can anyone text me and follow me
Answers: 1
image
Computers and Technology, 24.06.2019 13:50, jaystarr9395
Write a program that performs a simple n-body simulation, called "jumping leprechauns." this simulation involves n leprechauns, numberd 1 to n. it maintains a gold value g_i for each leprechaun i, which begins with each leprechaun starting out with a million dollars worth of gold, that is, g_i = 1000000 for each i = 1,. in addition, the simulation also maintains, for each leprachaun, i, a place on the horizon, which is represented as a double-precision floating point number, x_i. in each iteration of the simulation, the simulation processes the leprachauns in order. processing a leprachaun i during its iteration begins by computing a new place on the horizon for i, which is determined by the assignment:
Answers: 3
image
Computers and Technology, 24.06.2019 15:00, mbede002
Who introduced the concept of combining artificial and natural light in the studio
Answers: 1
image
Computers and Technology, 24.06.2019 17:30, NEONREDBLADE
Match the following. 1. formatting that is applied when cell data meets certain criteria 2. borders with formats not found on the border tool 3. a shortcut bar that contains tools for commonly used formats 4. formats that can be applied to numbers conditional formatting custom borders format bar number formats
Answers: 3
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 in other subjects:

Konu
English, 15.04.2020 05:35
Konu
Biology, 15.04.2020 05:35
Konu
English, 15.04.2020 05:35