fork download
  1. // Torrez, Elaine CS1A Chapter 2 P. 81, #6
  2.  
  3. /******************************************************************************************
  4.  *
  5.  * CALCULATE ANNUAL PAY
  6.  *
  7.  * --------------------------------------------------------------------------------
  8.  * This program calculates annual pay by multiplying pay per period by the number
  9.  * of periods in a year.
  10.  * --------------------------------------------------------------------------------
  11.  *
  12.  * INPUT
  13.  * payAmount : amount earned each pay period
  14.  * payPeriods : number of pay periods in a year
  15.  *
  16.  * OUTPUT
  17.  * annualPay : total annual salary
  18.  *
  19.  *******************************************************************************************/
  20.  
  21. #include <iostream>
  22. #include <iomanip> // Included for fixed and setprecision
  23. using namespace std;
  24.  
  25. int main()
  26. {
  27. double payAmount; // Pay earned per period
  28. int payPeriods; // Number of pay periods in a year
  29. double annualPay; // Total annual pay
  30.  
  31. payAmount = 1700.0; // INPUT pay per period
  32. payPeriods = 26; // INPUT number of periods
  33.  
  34. annualPay = payAmount * payPeriods; // Compute annual pay
  35.  
  36. cout << fixed << setprecision(2);
  37.  
  38. // OUTPUT annual salary
  39. cout << "Annual Pay: $" << annualPay << endl;
  40.  
  41. return 0;
  42. }
  43.  
Success #stdin #stdout 0.01s 5324KB
stdin
Standard input is empty
stdout
Annual Pay: $44200.00