1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
int main()
{
string heading1, heading2, employee, supervisor, id, telephone, address ;
double fall, spring, summer, final, per4 ;
const double FALL_PER = 0.39, SPRING_PER = 0.37, SUMMER_PER = 0.24 ;
char per0 = '0', per1 = '1', per2 = '3', per3 = '5';
ifstream fin ; // To read from the input file
ofstream fout ; // To write result in output file
fin.open("Project2_ID_Input.txt") ; // Opening input file
fout.open("Project2_ID_Output.txt") ; // Opening output file
// Importing data from the input file
getline(fin, heading1) ;
getline(fin, heading2) ;
getline(fin, employee) ;
getline(fin, supervisor) ;
getline(fin, id) ;
getline(fin, telephone) ;
getline(fin, address) ;
fin >> fall ;
fin >> spring ;
fin >> summer ;
// Calculate the total weight
final = (fall * FALL_PER) + (spring * SPRING_PER) + (summer * SUMMER_PER) ;
// Writing date to the output file
fout << '\t' << '\t' << '\t' << '\t' <<'\t'<< " " << heading1 ;
fout << '\t' << heading2 << endl;
fout << endl ;
fout << '\t' << '\t' << '\t' <<" Name of the Employee: " << setw(17) << employee ;
fout << '\t' << '\t' << '\t' <<" Name of the Supervisor: " << setw(16) << supervisor ;
fout << '\t' << '\t' << '\t' <<" Employee ID #: " << setw(15) << id ;
fout << '\t' << '\t' << '\t' <<" Telephone Number: " << setw(20) << telephone ;
fout << '\t' << '\t' << '\t' <<" Address: " << setw(46) << address ;
fout << '\t' << '\t' << '\t' <<" Fall Semester Evaluation: " << setw(10) << setprecision(2) << fixed << fall << endl;
fout << '\t' << '\t' << '\t' <<" Spring Semester Evaluation: " << setw(10) << setprecision(2) << fixed << spring << endl;
fout << '\t' << '\t' << '\t' <<" Summer Semester Evaluation: " << setw(10) << setprecision(2) << fixed << summer << endl;
fout << '\t' << '\t' << '\t' <<" Final Weighted Evaluation: " << setw(10) << setprecision(2) << fixed << final << endl;
if (final < 70)
fout << '\t' << '\t' << '\t' <<" Salary Raise: " << setw(6) << per0 << "%\n" << "\nWarning: You'r not getting a penny from us" ;
else if (final < 75 && final > 70)
fout << '\t' << '\t' << '\t' <<" Salary Raise: " << setw(6) << per0 << "%" << endl;
else if (final > 75 && final < 80)
fout << '\t' << '\t' << '\t' <<" Salary Raise: " << setw(6) << per1 << "%" << endl;
else if (final > 80 && final < 90)
fout << '\t' << '\t' << '\t' <<" Salary Raise: " << setw(6) << per2 << "%" << endl;
else if (final > 90 && final < 100)
fout << '\t' << '\t' << '\t' <<" Salary Raise: " << setw(6) << per3 << "%\n" << "\nWah Wah Wee Wah!: You are the boss !" << endl;
else if (final > 100)
fout << '\t' << '\t' << '\t' <<" Salary Raise: " << setw(6) << per4 << "%\n" << "\nWah Wah Wee Wah!: You are the boss !" << endl;
else
fout << "Invalid Entry" ;
fout << endl ;
fout << "Note: This report for " << getline(fin, employee) <<" was prepared according to the fair practice of the University." << endl ;
fout << "Any discrepancies must be reported by " << employee << " to the supervisor, " << supervisor << "." << endl ;
fin.close () ; // Closing input file
fout.close () ; // Closing output file
return 0;
}
|