Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. /*****************************************************************
  2. * AUTHOR : Joseph De Ruyter
  3. * ASSIGNMENT #1 : Basic Input / Output
  4. * CLASS : CSC5
  5. * SECTION : MW 2:20p - 5:30p
  6. * DUE DATE : 9/18/2019
  7. ****************************************************************/
  8.  
  9. #include <iostream>
  10. #include <iomanip>
  11. #include <string>
  12. using namespace std;
  13.  
  14. /****************************************************************
  15. *
  16. * COMPUTE RETROACTIVE PAY
  17. * ______________________________________________________________
  18. * This program accepts as user input an employee
  19. * name, current annual salary and percent increase
  20. * and computes a new annual salary, new monthly
  21. * salary and retroactive pay due. The program will
  22. * execute three times prompting the user for the
  23. * appropriate input and then displaying the computed
  24. * values for the given input.
  25. *
  26. * Computations are based on the assumption that input
  27. * values are effective on January 1 and calculations
  28. * are effective for July 1.
  29. * ______________________________________________________________
  30. * INPUT
  31. * nameFull : Employee's full name
  32. * salaryCurrent : Current annual salary
  33. * percent : Percent increase due
  34. *
  35. * OUTPUT
  36. * salaryNew : New salary after applying rate increase
  37. * salaryMonthly : New monthly salary
  38. * retroactivePay : Retroactive pay due employee
  39. *
  40. ****************************************************************/
  41.  
  42. int main()
  43. {
  44. /******************************************************
  45. * CONSTANTS
  46. * ----------------------------------------------------
  47. * MONTHS : Total number of months
  48. * RETRO_MONTHS : Number of months retroactive
  49. *****************************************************/
  50. const int MONTHS = 12;
  51. const int RETRO_MONTHS = 6;
  52.  
  53. char nameFull[30]; // INPUT - Employee's full name
  54. float salaryCurrent; // INPUT - Current annual salary
  55. float percentIncrease; // INPUT - Percent increase due
  56. float salaryNew; // OUTPUT - New salary after increase
  57. float salaryMonthly; // OUTPUT - New monthly salary
  58. float retroactivePay; // OUTPUT - Retroactive pay due employee
  59. int count; // CALC - Counter for loop
  60.  
  61. // Display header
  62. cout << "*******************************************" << endl;
  63. cout << "* PROGRAMMED BY : Joseph De Ruyter" << endl;
  64. cout << "* CLASS : CSC5" << endl;
  65. cout << "* SECTION : MW 2:20p-5:30p" << endl;
  66. cout << "* PROJECT #1 : Basic Input / Output" << endl;
  67. cout << "*****************************************" << endl;
  68. cout << endl;
  69. // Create for loop
  70. for (count = 0; count <= 2; ++count) {
  71. // Prompts for the user to respond to
  72. cout << "What is your name?" << endl;
  73. cin.getline(nameFull, 30);
  74. cout << nameFull << endl;
  75. cout << "What is your current salary?" << endl;
  76. cin >> salaryCurrent;
  77. cout << salaryCurrent << endl;
  78. cout << "What is your pay increase?" << endl;
  79. cin >> percentIncrease;
  80. cout << percentIncrease << endl;
  81. cout << "\n";
  82.  
  83. // Calculate salaryNew, salaryMonthly, & retroactivePay
  84. salaryNew = (salaryCurrent * percentIncrease) + salaryCurrent;
  85. salaryMonthly = salaryNew / MONTHS;
  86. retroactivePay = (salaryCurrent * percentIncrease)/2.00;
  87.  
  88. // Output the new annual salary, monthly salary, and retroactive pay.
  89. cout << nameFull << "'s SALARY INFORMATION" << endl;
  90. cout << "New Salary Monthly Salary Retroactive Pay" << endl;
  91. cout << setprecision(2) << fixed <<setw(10) << salaryNew << setw(19) << salaryMonthly << setw(20) << retroactivePay << endl;
  92.  
  93. // Output <press enter to continue> , Pause system until enter is pressed.
  94. cout << endl;
  95. cout << "<Press enter to continue>" << endl;
  96. cin.ignore();
  97. cin.get();
  98. cout << endl;
  99. }
  100. return 0;
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement