Define a function print_variables_over_time(c_0, tn_0, tp_0, percent_reduction, final_year) that accepts current levels for CHLA, TN, and TP and prints out a table showing a forecast of these values over time, provided all are reduced by the given percentage each year. Parameter summary c_0, tn_0, and tp_0 are initial CHLA, TN, and TP values respectively (i.e. at year 0). percent_reduction is the percentage reduction in all three values, per year, and will be given as a value between 0 and 100. final_year = number of the last year to print, e.g. 4 means print years 0, 1, 2, 3, 4. You can assume final_year is at least 1. Notes: Use 'Year CHLA TN TP' for the header row. The year should be printed with width 3 (ie, :3d will be helpful) CHLA, TN, and TP should be printed with width 10 and 2 decimal places. (Hint: :10.2f will help.) You must use a while loop for this - it will help with the next question! You cannot use any for loops or list comprehensions
Define a function print_variables_over_time(c_0, tn_0, tp_0, percent_reduction, final_year) that accepts current levels for CHLA, TN, and TP and prints out a table showing a forecast of these values over time, provided all are reduced by the given percentage each year. Parameter summary c_0, tn_0, and tp_0 are initial CHLA, TN, and TP values respectively (i.e. at year 0). percent_reduction is the percentage reduction in all three values, per year, and will be given as a value between 0 and 100. final_year = number of the last year to print, e.g. 4 means print years 0, 1, 2, 3, 4. You can assume final_year is at least 1. Notes: Use 'Year CHLA TN TP' for the header row. The year should be printed with width 3 (ie, :3d will be helpful) CHLA, TN, and TP should be printed with width 10 and 2 decimal places. (Hint: :10.2f will help.) You must use a while loop for this - it will help with the next question! You cannot use any for loops or list comprehensions
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 9SA
Related questions
Question
Define a function print_variables_over_time(c_0, tn_0, tp_0, percent_reduction, final_year) that accepts current levels for CHLA, TN, and TP and prints out a table showing a forecast of these values over time, provided all are reduced by the given percentage each year.
Parameter summary
c_0, tn_0, and tp_0 are initial CHLA, TN, and TP values respectively (i.e. at year 0).
percent_reduction is the percentage reduction in all three values, per year, and will be given as a value between 0 and 100.
final_year = number of the last year to print, e.g. 4 means print years 0, 1, 2, 3, 4. You can assume final_year is at least 1.
Notes:
Use 'Year CHLA TN TP' for the header row.
The year should be printed with width 3 (ie, :3d will be helpful)
CHLA, TN, and TP should be printed with width 10 and 2 decimal places. (Hint: :10.2f will help.)
You must use a while loop for this - it will help with the next question!
You cannot use any for loops or list comprehensions.
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning