Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*****************************************************************
- * AUTHOR : Joseph De Ruyter
- * ASSIGNMENT #1 : Basic Input / Output
- * CLASS : CSC5
- * SECTION : MW 2:20p - 5:30p
- * DUE DATE : 9/18/2019
- ****************************************************************/
- #include <iostream>
- #include <iomanip>
- #include <string>
- using namespace std;
- /****************************************************************
- *
- * COMPUTE RETROACTIVE PAY
- * ______________________________________________________________
- * This program accepts as user input an employee
- * name, current annual salary and percent increase
- * and computes a new annual salary, new monthly
- * salary and retroactive pay due. The program will
- * execute three times prompting the user for the
- * appropriate input and then displaying the computed
- * values for the given input.
- *
- * Computations are based on the assumption that input
- * values are effective on January 1 and calculations
- * are effective for July 1.
- * ______________________________________________________________
- * INPUT
- * nameFull : Employee's full name
- * salaryCurrent : Current annual salary
- * percent : Percent increase due
- *
- * OUTPUT
- * salaryNew : New salary after applying rate increase
- * salaryMonthly : New monthly salary
- * retroactivePay : Retroactive pay due employee
- *
- ****************************************************************/
- int main()
- {
- /******************************************************
- * CONSTANTS
- * ----------------------------------------------------
- * MONTHS : Total number of months
- * RETRO_MONTHS : Number of months retroactive
- *****************************************************/
- const int MONTHS = 12;
- const int RETRO_MONTHS = 6;
- char nameFull[30]; // INPUT - Employee's full name
- float salaryCurrent; // INPUT - Current annual salary
- float percentIncrease; // INPUT - Percent increase due
- float salaryNew; // OUTPUT - New salary after increase
- float salaryMonthly; // OUTPUT - New monthly salary
- float retroactivePay; // OUTPUT - Retroactive pay due employee
- int count; // CALC - Counter for loop
- // Display header
- cout << "*******************************************" << endl;
- cout << "* PROGRAMMED BY : Joseph De Ruyter" << endl;
- cout << "* CLASS : CSC5" << endl;
- cout << "* SECTION : MW 2:20p-5:30p" << endl;
- cout << "* PROJECT #1 : Basic Input / Output" << endl;
- cout << "*****************************************" << endl;
- cout << endl;
- // Create for loop
- for (count = 0; count <= 2; ++count) {
- // Prompts for the user to respond to
- cout << "What is your name?" << endl;
- cin.getline(nameFull, 30);
- cout << nameFull << endl;
- cout << "What is your current salary?" << endl;
- cin >> salaryCurrent;
- cout << salaryCurrent << endl;
- cout << "What is your pay increase?" << endl;
- cin >> percentIncrease;
- cout << percentIncrease << endl;
- cout << "\n";
- // Calculate salaryNew, salaryMonthly, & retroactivePay
- salaryNew = (salaryCurrent * percentIncrease) + salaryCurrent;
- salaryMonthly = salaryNew / MONTHS;
- retroactivePay = (salaryCurrent * percentIncrease)/2.00;
- // Output the new annual salary, monthly salary, and retroactive pay.
- cout << nameFull << "'s SALARY INFORMATION" << endl;
- cout << "New Salary Monthly Salary Retroactive Pay" << endl;
- cout << setprecision(2) << fixed <<setw(10) << salaryNew << setw(19) << salaryMonthly << setw(20) << retroactivePay << endl;
- // Output <press enter to continue> , Pause system until enter is pressed.
- cout << endl;
- cout << "<Press enter to continue>" << endl;
- cin.ignore();
- cin.get();
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement