Problem 2. (expectedcost) 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 percentage to a fraction,

Answers

Answer 1

The program that outputs the estimated cost of the item after the specified period with inflation rate as a percentage and convert the percentage to a fraction is; As written below

How to write a program in Java?

The input for this program is;

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. " );

}

}

The output is;

Enter the cost :2000

Enter the number of years:12

Enter the inflation rate:0.056

Item will cost about $ 2013.48 in 12 years.

Read more about Java Programming at; https://brainly.com/question/18554491


Related Questions

When you are in _______ cell in a row of a table, pressing Tab moves the insertion point to the first cell in the next row. A. the center B. any C. the first D. the last

Answers


When you are in B.any cell in a row of a table, pressing Tab moves the insertion point to the first cell in the next row.
When you are in D last cell in a row of a table, pressing Tab moves the insertion point to the first cell in the next row.
Other Questions
Evaluate the extent which trans atlantic interactions from 1600-1763, contributed to maintaining continuity as well as fostering change in labor systems in the british north american colonies. Population growth is highest in which countries answers apex how old is tom joad grapes of wrath Jessie enjoys running everyday for excercise. On Monday, he ran 3.30 miles. On Tuesday, he ran 3.09 miles and on Wednesday he ran 2.98 miles. On what day did Jessie run the farthest? A jet plane, flying 120 mph faster than a propeller plane, travels 3520 miles in 3 hours less time than the propeller plane takes to fly the same distance. how fast does each plane fly? How does guilt play a role in poe's stories? Write an integer for each situation identify its opposite and describes its meaningQuestion: 5 strokes above par Companies that are go-betweens that link suppliers with the traveling public are called _____. __________ is an increase in the frequency of a behavior when it results in avoidance of or escape from something. Which supreme court case in 1869 resolved the debate over whether states can secede from the union? What protects most bacteria from swelling up and bursting in hypotonic solutions? I need to learn how to do this If f is a function defined by the equation yequals=f(x) then x is called the What simple chemical test is useful in the identification of the mineral calcite or any of the minerals found in the carbonate group? Need Help Fast!!How did most Georgians acquire land before 1903A. Through the lottery system B. By being the highest bidder C. Through the headright system D. By having a government job Choose the correct pronoun to complete the sentence. Though her friend Ellen worked hard, Frances swam more laps than ___she or her In a class, three students were running for president. Sara got 1/2 of the votes, Mike got 1/3 of the votes. What fraction of the votes did Imani get? What is the mass number of an iron atom that has 28 neutrons? PLEASE HELP!Identify the adjectives and adverbs.Ginger received many gracious words of thanks from her grateful friends for the wonderful meal. A. many, gracious, her, grateful, the, wonderful, meal B. Ginger, many, gracious, thanks, her, friends, the, wonderful C. many, gracious, her, grateful, the, wonderful D. many, gracious, of, thanks, grateful, the, wonderful When taking study notes for a biology course, which details are least likely to be relevant in a passage about sand flea infestations? Many people have never heard of sand fleas. The sand flea is found along the Atlantic coast from Canada to Argentina. Some types of sand fleas grow up to one inch in length. Sand fleas feed on organic material like plants and animals. Steam Workshop Downloader