Question

In: Computer Science

It is difficult to make a budget that spans several years, because prices are not stable....

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. 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.

Solutions

Expert Solution

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

import java.util.Scanner;

public class TestDemo {

   public static void main(String[] args) {
       double cost, inflation;
       int years;
       Scanner input = new Scanner(System.in);
       System.out.print("Enter the cost :");
       cost = input.nextDouble();
       System.out.print("Enter the number of years:");
       years = input.nextInt();
       System.out.print("Enter the inflation rate:");
       inflation = input.nextDouble() * .01;
       for (int i = 0; i < years; i++)
           cost += cost * inflation;
       cost = (int) (cost * 100) / 100.0;
       System.out.println("Item will cost about $ " + cost + " in " + years + " years. " );
   }
}

Kindly revert for any queries

Thanks.


Related Solutions

Explain why stagflation (rising prices coinciding with declining output) is difficult to reconcile with a stable...
Explain why stagflation (rising prices coinciding with declining output) is difficult to reconcile with a stable FE curve.
Burkholderia and Pseudomonas aeruginosa are common sources of hospital infections. Several characteristics make them difficult to...
Burkholderia and Pseudomonas aeruginosa are common sources of hospital infections. Several characteristics make them difficult to eradicate. Which one of the following in NOT one of the reasons?
Tuition prices have increased so much in recent years that a quality education can seem difficult...
Tuition prices have increased so much in recent years that a quality education can seem difficult to afford. Online universities, trade schools and code camps are a few alternatives that have gained popularity, but there is something to be said for the traditional college experience. How might we develop a collegiate experience that is affordable, engaging, and incorporates technology as its major component?
tastes affect prices, because
tastes affect prices, because
You are in charge of a group that is very difficult to work with because the...
You are in charge of a group that is very difficult to work with because the group members have little interest in doing the tasks to which they are assigned. Because you are accountable to your supervisors for seeing to it that the group gets the task finished, you realize you need to adjust your leadership style so that you can be sure the work is completed. What factor(s) you would consider as you determined what leadership style to adopt...
For the sake of this class the desired goals are always Full Employment, Stable Prices and...
For the sake of this class the desired goals are always Full Employment, Stable Prices and Economic Growth. The US economy, as well as the rest of the world, has experienced a huge negative shock this year. It has caused unemployment rates to increase, GDP to decrease and while prices have been fairly stable that may not hold. Question: Identify a potential policy change you feel may improve the US economy. Be specific, explain what the policy is, what the...
World oil prices have been rapidly swinging over the last few years, in part because of...
World oil prices have been rapidly swinging over the last few years, in part because of the declining value of the U.S. dollar, changes in supply and demand, and OPEC’s attempts to manage output in order to maintain higher prices. (OPEC stands for the Organization of Petroleum Exporting Countries) As the president of an oil producing and exporting company in Alberta: Explain how you may use hedging to protect your company’s income. Share a recent publication with your fellow students...
World oil prices have been rapidly swinging over the last few years, in part because of...
World oil prices have been rapidly swinging over the last few years, in part because of the declining value of the U.S. dollar, changes in supply and demand, and OPEC’s attempts to manage output in order to maintain higher prices. (OPEC stands for the Organization of Petroleum Exporting Countries) As the president of an oil producing and exporting company in Alberta: Explain how you may use hedging to protect your company’s income. Share a recent publication with your fellow students...
Because accounting is considered the language of business, it may be difficult to think there is...
Because accounting is considered the language of business, it may be difficult to think there is a relationship between accounting and faith; however, the Christian worldview should and can permeate every discipline, even accounting. In what way(s) do you think the Christian worldview can integrate with accounting?
(Econometrics) Oil prices are notoriously difficult to predict. People studying commodity prices often refer to random...
(Econometrics) Oil prices are notoriously difficult to predict. People studying commodity prices often refer to random oil shocks as the most important determinant of current oil price. How would you build this model? Be thorough in your reasoning and explicit in model specification.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT