1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
AVprozaik [17]
3 years ago
9

Write a program that outputs inflation rates for two successive years and whether the inflation is increasing or decreasing. Ask

the user to input the current price of an item and its price one year and two years ago. To calculate the inflation rate for a year, subtract the price of the item for that year from the price of the item one year ago and then divide the result by the price a year ago. Your program must contain at least the following functions: a function to get the input, a function to calculate the results, and a function to output the results. Use appropriate parameters to pass the information in and out of the function. Do not use any global variables.
Computers and Technology
1 answer:
MrRissso [65]3 years ago
8 0

Answer:

#include

using namespace std;

void getInput(double currentPrice, double priceYear1, double priceYear2){

   cin >> currentPrice;

   cin >> priceYear1;

   cin >> priceYear2;

}

void printInflationRate( double myRate){

   cout<< "The inflation rate for the year price = "<< rate;

}

void calInflation(double targetPrice, double yearBefore){

   double rate = (yearBefore - targetPrice)/ yearBefore;

   printInflationRate( rate);

}

int main(){

   double cprice, year1price, year2price, rate;

   getInput(cprice, year1price, year2price);

   calInflationRate(cprice, year1price);

   calInflationRate(year1price, year2price);

   return 0;

}

Explanation:

The C++ program source code defines three void functions (functions with no return statement), 'calInflationRate', 'getInput', and printInflationRate. In the main program code, the four float point number variables are declared, and the getInput function assigns values to them. The calInflationRate function calculates the inflation rate of a given year, and it in, the printInflationRate is called to print the output on the screen.

You might be interested in
How many megapixels is in a macbook air 2017 camera
Anastasy [175]

Answer:

.7

Explanation:

3 0
3 years ago
All of the following are ways to limit what is tracked about you online, except:
Veseljchak [2.6K]

Answer:b

Explanation: turning off your screen does nothing on the cyber side and people and companies can still access your internet history even while your screen is off

5 0
3 years ago
What does a for loop look for in the sequence of data? Check all that apply.
ValentinkaMS [17]

Answer:

All

Explanation:

Not sure on the context of this question, but a loop is generally used to iterate though every piece of data to perform some kind of operation, on everything in something like an array or string.

7 0
2 years ago
Read 2 more answers
Hi I need help, This assignment is for Assignment 6 Question 3 in edhesive for computer science. here is the prompt:
miv72 [106K]

Answer: print("THIRD")

for i in range(10):

   for j in range(10-i):

       print(" ", end=" ")

   for j in range(i):

       print("*", end=" ")

   print("")

Explanation:

You're Welcome yall

print("THIRD")

for i in range(10):

   for j in range(10-i):

       print(" ", end=" ")

   for j in range(i):

       print("*", end=" ")

   print("")

6 0
3 years ago
This feature in Word Online allows you to view your document to see what it will look like when printed.
kherson [118]

Answer:

Print preview allows you to view your document before printing

7 0
3 years ago
Read 2 more answers
Other questions:
  • Build three classes that conform to the following interfaces. Use arrays in creating your classes (e.g., do not use the built-in
    8·1 answer
  • Fax machines, voice mail, electronic mail, and electronic conferencing are all examples of _________.
    15·2 answers
  • GAMES Which is better Roblox or BattleCamp Basically Free Points But Please Answer
    7·2 answers
  • Which of the following topics should you avoid bringing up during a college interview?
    10·2 answers
  • When a diaphragm contracts, a person is<br>Exhaling<br>Inhaling​
    12·2 answers
  • In general, digital to analog modulation equipment is less expensive than the equipment for encoding digital data into a digital
    8·1 answer
  • Which is a natural hazard that can cause extinctions? Choose all that apply.
    6·1 answer
  • _____ interviews rely on scenarios and reflections to evaluate an applicant’s skill set.
    9·2 answers
  • Is it true or false and incomplete doing can be saved in Paint​
    15·1 answer
  • What will be the result from running the following program?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!