Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help woth the code in C++ Write a complete C++ program to report on the inflation rate for an item. The inflation rate is
Please help woth the code in C++
Write a complete C++ program to report on the inflation rate for an item. The inflation rate is defined as (currentCost - yearAgoCost) / yearAgoCost Input, in a file named prices.txt, has text identifying the item on the first line. The second line has the yearAgoCost value, some spaces, then the currentCost value. One input example is: Hot dog with everything 10.75 12.05 A second input example could be: Oak Table 1099.99 2100.99 Output is written to a file named rate.txt; it identifies the item and its inflation rate both as a decimal and as a percent. Show 5 decimal places. For the first example of input shown above, the output appears as follows: Inflation rate for Hot dog with everything is.12093 which is 12.093%. Extra Credit: Also output the statement Inflation rate is too high. if the inflation rate is over 5.0%. If the inflation rate is greater than 2.0% but less than or equal to 5.0%, output Inflation rate is somewhat high If the inflation rate is 2.0% or less, output Inflation rate is reasonable
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started