fork download
  1. //Jacklyn Isordia CSC5 Chapter 5, P. 294, #05
  2. //
  3. /**************************************************************
  4.  *
  5.  * CALCULATE PROJECTED MEMBERSHIP FEES
  6.  * ____________________________________________________________
  7.  * This program displays the projected membership fees for a
  8.  * country club over the next six years, with a 4% annual
  9.  * increase.
  10.  * ____________________________________________________________
  11.  * INPUT
  12.  * None (Constants used for starting fee and rate)
  13.  * OUTPUT
  14.  * A table showing the projected membership fee for each
  15.  * of the 6 years.
  16.  * Formula
  17.  * membershipFee = membershipFee + (membershipFee * 0.04)
  18.  *
  19.  **************************************************************/
  20.  
  21. #include <iostream>
  22. #include <iomanip>
  23. using namespace std;
  24.  
  25. int main() {
  26.  
  27. double membershipFee = 2500.0;
  28. const double INCREASE_RATE = 0.04;
  29.  
  30. cout << "Projected Membership Rates for the Next 6 Years" << endl;
  31. cout << "_______________________________________________" << endl;
  32.  
  33. cout << fixed << showpoint << setprecision(2);
  34.  
  35. for (int year = 1; year <=6;year++) {
  36.  
  37. membershipFee += (membershipFee * INCREASE_RATE);
  38. cout << "Year" << year << ": $" << membershipFee << endl;
  39. }
  40. return 0;
  41. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
Projected Membership Rates for the Next 6 Years
_______________________________________________
Year1: $2600.00
Year2: $2704.00
Year3: $2812.16
Year4: $2924.65
Year5: $3041.63
Year6: $3163.30