prokillerinminecraft

Lab Exercise 9 part 2

Dec 10th, 2021 (edited)
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     cout << "Category Avail:\n";
  8.     cout << "Full-Time : 5%\n";
  9.     cout << "Part-Time : 2%\n";
  10.     char conf = 'Y';
  11.     string cat;
  12.     double sal;
  13.     int full = 0, part = 0, sum = 0, count = 0;
  14.     for(int i = 0;conf != 'N';count++)
  15.     {
  16.         cout << "Employee category: ";
  17.         cin >> cat;
  18.         cout << "Enter Salary: RM ";
  19.         cin >> sal;
  20.         cout << "Your new Salary after bonus: ";
  21.         if(cat == "Full-Time")
  22.         {
  23.             i = sal * 1.05;
  24.             cout << setprecision(2) <<  i;
  25.             sum += i;
  26.             full++;
  27.         }
  28.         else
  29.         {
  30.             i = sal * 1.02;
  31.             cout << setprecision(2) << i;
  32.             sum += i;
  33.             part++;
  34.         }
  35.         cout << "\n\nDo you want to continue ( Y/N ): ";
  36.         cin >> conf;
  37.         cout << endl;
  38.     }
  39.     cout << endl;
  40.     cout << "OVERALL AVERAGE NEW SALARY (RM): " << sum / count << endl;
  41.     cout << "NUMBER OF FULL-TIME EMPLOYERS: " << full << endl;
  42.     cout << "NUMBER OF PART-TIME EMPLOYERS: " << part ;
  43. }
Add Comment
Please, Sign In to add comment