fork download
  1. // Marvyn De La Torre CS1A Chapter 5, P.294, #5
  2. /**************************************************************
  3. //
  4. // CALCULATE MEMBERSHIP FEES
  5. // ____________________________________________________________
  6. // This program calculates the projected country club membership
  7. // fee for each of the next six years after a 4% yearly increase.
  8. //
  9. // INPUT:
  10. // No input.
  11. //
  12. // OUTPUT:
  13. // The projected membership fee for each of the next six years.
  14. //
  15. **************************************************************/
  16.  
  17. #include <iostream>
  18. #include <iomanip>
  19. using namespace std;
  20.  
  21. int main()
  22. {
  23. double fee = 2500.00;
  24.  
  25. cout << fixed << setprecision(2);
  26.  
  27. for (int year = 1; year <= 6; year++)
  28. {
  29. fee = fee * 1.04;
  30. cout << "Year " << year << ": $" << fee << endl;
  31. }
  32.  
  33. return 0;
  34. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
Year 1: $2600.00
Year 2: $2704.00
Year 3: $2812.16
Year 4: $2924.65
Year 5: $3041.63
Year 6: $3163.30