Advertisement
Guest User

Untitled

a guest
Sep 11th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. /*****************************************************************
  2. * AUTHOR : Samantha Lopez
  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. using namespace std;
  12.  
  13. /****************************************************************
  14. *
  15. * COMPUTE RETROACTIVE PAY
  16. * ______________________________________________________________
  17. * This program accepts as user input an employee
  18. * name, current annual salary and percent increase
  19. * and computes a new annual salary, new monthly
  20. * salary and retroactive pay due. The program will
  21. * execute three times prompting the user for the
  22. * appropriate input and then displaying the computed
  23. * values for the given input.
  24. *
  25. * Computations are based on the assumption that input
  26. * values are effective on January 1 and calculations
  27. * are effective for July 1.
  28. * ______________________________________________________________
  29. * INPUT
  30. * nameFull : Employee's full name
  31. * salaryCurrent : Current annual salary
  32. * percent : Percent increase due
  33. *
  34. * OUTPUT
  35. * salaryNew : New salary after applying rate increase
  36. * salaryMonthly : New monthly salary
  37. * retroactivePay : Retroactive pay due employee
  38. *
  39. ****************************************************************/
  40.  
  41. int main()
  42. {
  43. /******************************************************
  44. * CONSTANTS
  45. * ----------------------------------------------------
  46. * MONTHS : Total number of months
  47. * RETRO_MONTHS : Number of months retroactive
  48. *****************************************************/
  49. const int MONTHS = 12;
  50. const int RETRO_MONTHS = 6;
  51.  
  52. char nameFull[30]; // INPUT - Employee's full name
  53. float salaryCurrent; // INPUT - Current annual salary
  54. float percentIncrease; // INPUT - Percent increase due
  55. float salaryNew; // OUTPUT - New salary after increase
  56. float salaryMonthly; // OUTPUT - New monthly salary
  57. float retroactivePay; // OUTPUT - Retroactive pay due employee
  58. int count; // CALC - Counter for loop
  59.  
  60. // Prompts for the user to respond to
  61. cout << "What is your name?" << endl;
  62. cin.getline(nameFull, 30);
  63. cout << "What is your current salary?" << endl;
  64. cin >> salaryCurrent;
  65. cout << "What is your pay increase?" << endl;
  66. cin >> percentIncrease >> endl;
  67. cout << "\n";
  68.  
  69. // Calculate salaryNew, salaryMonthly, & retroactivePay
  70. salaryNew = (salaryCurrent * percentIncrease) + salaryCurrent;
  71. salaryMonthly = salaryNew / 12;
  72. retroactivePay = salaryMonthly * 6;
  73.  
  74. // Output the new annual salary, monthly salary,
  75. // and retroactive pay.
  76. cout << "Your new annual salary is " << salaryNew << endl;
  77. cout << "Your new monthly salary is " << salaryMonthly << endl;
  78. cout << "The retroactive pay you are due amounts to " << retroactivePay <<
  79.  
  80.  
  81.  
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement