I am getting the error \"No overload for method \'GrossPay\' takes 0 arguments.
ID: 3637850 • Letter: I
Question
I am getting the error "No overload for method 'GrossPay' takes 0 arguments.the same on CalcFedTax, CalcSSTax, CalcNet, and PayrollInfo.
Here is my code:
namespace LAB4A
{
public class Program
{
public static void Main()
{
string employeeName;
double regHrs, otHrs, payRate, grossPay, fedTax, ssTax, netPay;
//Calls the methods
DisplayTitle();
employeeName = GetName();
regHrs = GetRegHrs();
otHrs = GetOtHrs();
payRate = GetRate();
grossPay = GrossPay();
fedTax = CalcFedTax();
ssTax = CalcSSTax();
netPay = CalcNet();
PayrollInfo();
}
public static void DisplayTitle()
{
Console.WriteLine(" WEEKLY PAYROLL INFORMATION");
}
public static string GetName() // Employee's name.
{
string inputValue, eName;
Console.Write(" Please Enter the Employee's Name: ");
inputValue = Console.ReadLine();
eName = inputValue;
return eName;
}
public static double GetRegHrs() //Regular hours worked.
{
string inputValue;
double hrs1;
Console.Write(" Please Enter the number of regular hours worked this week: ");
inputValue=Console.ReadLine();
hrs1=double.Parse(inputValue);
return hrs1;
}
public static double GetOtHrs() //Overtime hours worked.
{
string inputValue;
double hrs2;
Console.Write(" Please Enter the number of overtime hours worked this week: ");
inputValue=Console.ReadLine();
hrs2 = double.Parse(inputValue);
return hrs2;
}
public static double GetRate() //Hourly pay rate.
{
string inputValue;
double pay;
Console.Write(" Please Enter the employee's hourly pay rate: ");
inputValue=Console.ReadLine();
pay = double.Parse(inputValue);
return pay;
}
public double GrossPay(double regHrs, double payRate, double otHrs) // Calculates the gross pay.
{
double grossPay;
grossPay = ((regHrs * payRate) + (otHrs * 1.5 * payRate));
return grossPay;
}
public static double CalcFedTax(double grossPay) //Calculates the federal tax with holdings.
{
double fedTax;
fedTax = (grossPay * .28);
return fedTax;
}
public static double CalcSSTax(double grossPay) //Calculates the Social Security tax with holdings.
{
double ssTax;
ssTax = (grossPay * .0765);
return ssTax;
}
public static double CalcNet(double grossPay, double fedTax, double ssTax) //Calculates the net pay of the employee.
{
double net;
net = (grossPay - fedTax - ssTax);
return net;
}
public static void PayrollInfo(string employeeName, double grossPay, double fedTax, double ssTax, double netPay) //Displays all information.
{
Console.WriteLine(" Weekly Payroll Information Summary for {0}", employeeName);
Console.WriteLine(" Gross Pay:{0,36:C}", grossPay);
Console.WriteLine(" Federal Income Taxes Withheld:{0,16:C}", fedTax);
Console.WriteLine(" Social Security Taxes Withheld:{0,17:C}",ssTax);
Console.WriteLine(" Net Pay:{0,38:C}",netPay);
Console.WriteLine("Press any key to continue");
Console.Read();
}
}
}
Explanation / Answer
see this method is taking 3 argumetns GrossPay(double regHrs, double payRate, double otHrs) grossPay = GrossPay(); but in above your are passing 0 arguments so please pass 3 argumetns to avoid that error.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.