//Charlotte Davies-Kiernan CS1A Chapter 5 P 294 #3
//
/******************************************************************************
*
* Display Ocean's Rising Levels
* ____________________________________________________________________________
* This program will display how much the ocean level will have risen each year
* for the next 25 years based off of a constant rate of ocean rising.
*
* Formula used:
* totalRise = year * rise_per_year
* ____________________________________________________________________________
* Input
* rise_per_year //rate of ocean levels rising per year (millimeters)
* years //amount of years (up to 25)
* Output
* totalRise //total rise of ocean according to each year
*****************************************************************************/
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double rise_per_year =1.5; //INPUT - constant rate of ocean levels rising 1.5 millimeters
int years = 25; //INPUT - amount of years the table will go up to which is 25
double totalRise; //OUTPUT - total rise of ocean based off the year
//
//Create Table
cout << "Year \t Rise (millimeters)" << endl;
cout << "-----------------------------" << endl;
//
//Calculation
for (int year = 1; year <= years; year++){
totalRise = year * rise_per_year;
cout << setw(4) << year << "\t" << fixed << setprecision(1) << totalRise << endl;
}
return 0;
}