fork download
  1. // Cameron Pham CS1A chapter 2, p. 81, #6
  2. //
  3. /******************************************************************************
  4.  *
  5.  * Displays Total Annual Pay of Employee
  6.  *
  7.  * _____________________________________________________________________________
  8.  * This program computes and displays an employee's annual pay and defines the
  9.  * variables that identifies how much the employee earns each pay period, the
  10.  * number of pay periods in a year, and the total annual pay.
  11.  *
  12.  * Computation is based on the formula:
  13.  * annualPay = payAmount * payPeriods
  14.  * _____________________________________________________________________________
  15.  * INPUT
  16.  * payAmount = amount of pay earned each pay period ($1700.0)
  17.  * payPeriods = number of pay periods in a year (26)
  18.  *
  19.  * OUTPUT
  20.  * annualPay = total annual pay
  21.  *
  22.  * ****************************************************************************/
  23. #include <iostream>
  24. using namespace std;
  25.  
  26. int main() {
  27. double payAmount; // INPUT = pay earned each pay period
  28. double payPeriods; // INPUT = number of pay periods each year
  29. double annualPay; // OUTPUT = total annual pay
  30.  
  31. // Initializing Program Variables
  32. payAmount = 1700.0;
  33. payPeriods = 26;
  34.  
  35. // Computing Pay
  36. annualPay = payAmount * payPeriods;
  37.  
  38. // Final Output
  39. cout << "Total annual pay = $" << annualPay << endl;
  40.  
  41. return 0;
  42. }
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
Total annual pay = $44200