Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Written in C++ Declare the following prototypes : void getPrices(double& current, double& priceOneYAgo, double& priceTwoYAgo); void calculateInflation(double currentP, double priceOneYAgo, double priceTwoYAgo, double& infCurrentY, double&

Written in C++

Declare the following prototypes :

void getPrices(double& current, double& priceOneYAgo, double& priceTwoYAgo);

void calculateInflation(double currentP, double priceOneYAgo, double priceTwoYAgo,

double& infCurrentY, double& infOneYAgo);

void printResult(double infCurrentY, double infOneYAgo);

In the mainline :

Declare variables for inputted values and the outputted values

Set manipulators so the scores are outputted with 2 decimal positions.

Call the getPrices function.

Call the calculateInflation function.

Call the printResult function.

End program.

After the mainline :

Define the functions :

getPrices function

Prompt user for prices and and accept them

calculateInflation function :

Calculate current year inflation rate and place it in a reference parameter

Calculate a year ago inflation rate and place it in a reference parameter

printResult function : Output per the sample executions shown below

Sample Executions :

Sample 1:

Enter the current price of the item: 100

Enter the price of the item one year ago: 80

Enter the price of the item two years ago: 40

Current year inflation: 0.25

Inflation one year ago: 1.00

Inflation is not increasing.

--------------------------------

Process exited with return value 0

Press any key to continue . . .

Sample 2:

Enter the current price of the item: 150

Enter the price of the item one year ago: 100

Enter the price of the item two years ago: 80

Current year inflation: 0.50

Inflation one year ago: 0.25

Inflation is increasing.

--------------------------------

Process exited with return value 0

Press any key to continue . . .

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions