fork download
  1. //Ryan Shahriyarpour CS1A Carl Argila CH5 HW Q:4
  2. //
  3. /*****************************************************************************
  4.  *
  5.  * Membership Fees Increase
  6.  *
  7.  *********************
  8.  *
  9.  * A country club currently charges $2,500 per year for membership and will
  10.  * increase its membership fee by 4% each year for the next six years.
  11.  * This program displays the projected rates for the next six years.
  12.  *
  13.  * INPUT
  14.  * None (fixed values used)
  15.  *
  16.  * OUTPUT
  17.  * Table showing year and projected membership fees
  18.  *
  19.  ****************************************************************************/
  20.  
  21. #include <iostream>
  22. #include <iomanip>
  23. using namespace std;
  24.  
  25. int main()
  26. {
  27. const double STARTING_FEE = 2500.0;
  28. const double INCREASE_RATE = 0.04;
  29.  
  30. double fee = STARTING_FEE;
  31.  
  32. cout << "Year\t\tMembership Fee\n";
  33. cout << "---------------------------------------\n";
  34.  
  35. // Display fees for the next 6 years
  36. for (int year = 1; year <= 6; year++)
  37. {
  38. fee = fee * (1 + INCREASE_RATE);
  39. cout << year << "\t\t$" << fixed << setprecision(2) << fee << endl;
  40. }
  41.  
  42. return 0;
  43. }
Success #stdin #stdout 0s 5300KB
stdin
Standard input is empty
stdout
Year		Membership Fee
---------------------------------------
1		$2600.00
2		$2704.00
3		$2812.16
4		$2924.65
5		$3041.63
6		$3163.30