Getting error for: float net = netAmount(gross, fica, federal);

  c++, function

This is the error im getting, sorry first time posting and very frustrated. Not sure who to fix it. Can anyone help me?

main.cpp:131:51: error: cannot convert ‘float (*)(float, std::string) {aka float (*)(float, std::basic_string)}’ to ‘float’ for argument ‘3’ to ‘float netAmount(float, float, float)’
         float net = netAmount(gross, fica, federal);
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;

    
    string firstName;
    string lastName;
    string maritalStat;
    float hourWage;
    float hourWorked;
    float grossAmount(float wage, float hours);
    float ficaTax(float gross);
    float fedtax(float earning, string status);
    float adjusted(float earning, int exempt);
    float netAmount(float gross, float fica, float federal);
    int exemption;
    

    //function to read input
   
    
    //Gross Amount
    float grossAmount(float wage, float hours){
        if (hours <=40)
        return wage*hours;
        
        return 40*wage + (hours-40)*1.5*wage;
    }
    //Fica Tax
    float adjusted(float gross){
        return gross*0.0565;
    }
    //Adjusted Income
    float adjusted(float earning, int exempt){
        return earning - 73.08*exempt;
    }
    //Federal Tax
    float federal(float earning, string status){
        if (status=="S"){
            if (earning >=0 && earning <=721)
            return 0;
            if (earning <= 7510)
            return 93.60 + (earning-721)*0.28;
            return 2167.16 + (earning-7510)*0.35;
        }
        else if (status=="M"){
            if (earning >=0 && earning <=1515)
            return 0;
            if (earning <=7624)
            return 187.15 + (earning-1515)*0.15;
            return 2020.42 + (earning-7624)*0.3;
        }
    }
    //Net Amount
    float netAmount(float gross, float fica, float federal){
        return gross-fica-federal;
    }





int main()
{
    ifstream infile("input.txt");
    ofstream outfile("output.txt");
    ofstream errorfile("error.txt");
    
     while (infile){
        ifstream infile;
        infile.open("input.txt");
        
        for (int i=0; i<15; i++){
            infile >> firstName;
            infile >> lastName;
            infile >> hourWage;
            infile >> hourWorked;
            infile >> exemption;
            infile >> maritalStat;
        }
        }
        infile.close();
    
    //Formating for output file 
    outfile << left << setfill(' ') << setw(15) << "Employee name";
    
    outfile << left <<setfill(' ') << setw(15) << "Hourly Worked";
    
    outfile << left << setfill(' ') << setw(15) << "Hourly Wage";
    
    outfile << left << setfill(' ') << setw(15) << "Deduction";
    
    outfile <<left << setfill(' ') << setw(15) << "Federal Tax";
    
    outfile <<left << setfill(' ') << setw(15) << "Gross Amount";
    
    outfile <<left << setfill(' ') << setw(15) << "New Amount"<<endl;
   
   //error file calculations 
   for ( int i=0; i < 15; i++){
       int f = 0; 
       if (hourWage <=0) {
           errorfile << "Hourly wage can't be zero or negative" << endl;
           f=1;
       }
       if (hourWorked <=0){
           errorfile << "Hours worked can't be zero or negative" << endl;
           f=1;
       }
       if (exemption < 0) {
           errorfile << "Numbers of exemptions can't be negative" << endl;
           f=1;
       }
       if (maritalStat !="S" && maritalStat !="M") {
           errorfile << "Martial status can only be single or married" << endl;
           f=1;
       }
   
   
    if (f==0){
        float gross = grossAmount(hourWage, hourWorked);
        float fica = ficaTax(gross);
        float adjustincome = adjusted(gross, exemption);
        float net = netAmount(gross, fica, federal);
    
    outfile << left << setfill(' ') << setw(8) << firstName;
    outfile << left << setfill(' ') << setw(8) << lastName;
    outfile << left << setfill(' ') << setw(15) << hourWorked;
    outfile << left << setfill(' ') << setw(15) << hourWage;
    outfile << left << setfill(' ') << setw(15) << gross-adjustincome;
    outfile << left << setfill(' ') << setw(15) << federal;
    outfile << left << setfill(' ') << setw(15) << gross;
    outfile << left << setfill(' ') << setw(15) << net << endl;
   }
}
  //close the files
    outfile.close();
    errorfile.close();
    infile.close();
    
    return 0;
}

Source: Windows Questions C++

LEAVE A COMMENT