Selection sort on a payroll program

Hello all, hope someone can help me out with this. Can someone please help me add a selection sort to my payroll program. I want to sort the net pay (ascending) and have it display the net pay before and after sorting. Any help would be greatly appreciated!

#include<fstream>
#include<iostream>
#include<iomanip>
using namespace std;
class payroll{
ifstream fin;
int n;
char employeename[20];
int hoursworked,overtime;
double hourlyrate,overtimepay,regularpay,grosspay,taxrate,taxamount,netpay;
double totalnetpay,avgnetpay;
void calculategrosspay();
void calculatetax();
void calculatenetpay();
void findavgnetpay();
void printheadings();
void printdata();
public:payroll();
~payroll();
void printreport(); };
payroll::payroll(){
fin.open("payroll.in"); }//CONSTRUCTOR
payroll::~payroll(){
fin.close(); }//DESTRUCTOR
void payroll::calculategrosspay(){
if(hoursworked > 40){
overtime=hoursworked-40;
regularpay=hoursworked*hourlyrate;
overtimepay=overtime*(hourlyrate*1.5);
grosspay=regularpay+overtimepay; }//IF
else{ grosspay=hoursworked*hourlyrate;
regularpay=grosspay;
overtimepay=0;}//ELSE
}//CALCULATEGROSSPAY
void payroll::calculatetax(){
taxrate=.30;
taxamount=grosspay*taxrate; }//CALCULATETAX
void payroll::calculatenetpay(){
netpay=grosspay-taxamount;
totalnetpay=totalnetpay+netpay;
}//CALCULATENETPAY
void payroll::findavgnetpay(){
avgnetpay= totalnetpay/n;
}//FINDAVGNETPAY
void payroll::printheadings(){
cout<<setw(40)<<"-PAYROLL PROGRAM-"<<endl;
cout<<"---------------------------------------------------------"<<endl;
cout<<" NAME HW HR OT-PAY GROSS TAX NETPAY"<<endl;
cout<<"---------------------------------------------------------"<<endl;
}//PRINTHEADINGS
void payroll::printdata(){
cout<<setprecision(2)<<setiosflags(ios::fixed|ios::showpoint);
cout<<setw(6)<<employeename<<setw(6)<<hoursworked<<setw(8)<<
hourlyrate<<setw(8)<<overtimepay<<setw(8)<<grosspay<<
setw(8)<<taxamount<<setw(8)<<netpay<<endl; }//PRINTDATA
void payroll::printreport(){
n=0; totalnetpay=0;
printheadings();
while(fin>>employeename>>hoursworked>>hourlyrate){
calculategrosspay();
calculatetax();
calculatenetpay();
printdata();
n++; }//WHILE

findavgnetpay();
cout<<endl<<"The average net pay for "<<n<<" employees is "<<avgnetpay<<endl;

}//PRINTREPORT


int main(){
payroll employee;
employee.printreport();
system ("pause");
}//MAIN
Can anyone help? Please?
Topic archived. No new replies allowed.