I am never taking a C# class again.

My question this time is I am trying to create an object named "newEmployee" in my main class that calls the employee class constructor method. My TL;DR constructor code is:

 // Constructor method
    public Employee(double hrsWorked, double rate) // These are defined elsewhere. See end of post for 
                                                   // total code if need be.
    {
        hoursWorked = hrsWorked;
        rateofPay = rate;
    }

Isn't that the name of my object too? as in:

// Object
Employee newEmployee = new Employee(double hrsWorked, double rate);

I swear that is how it is in the book. But, I keep getting the errors (ALL on line 29)

Error 3 ; expected
Error 4 ; expected
Error 6 ; expected
Error 5 Invalid expression term ')'
Error 2 Invalid expression term ','
Error 1 Invalid expression term 'double'
Error 7 Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
Error 8 Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement

Does VS just hate me and want me to stop trying to write code or what?

Here's the full code just incase I do not know what I'm talking about:

using System;
using SC = System.Console;
public class Lab18
{ // Main method
    public static void Main()
    {
        string hoursWorkedStr, rateofPayStr;
        double hrsWorked, rateofPay;

        SC.WriteLine("Lab 18");

        //Input
        SC.Write("\nPlease input hours worked: ");
        hoursWorkedStr = Console.ReadLine();
        hrsWorked = Convert.ToDouble(hoursWorkedStr);

        SC.Write("\nPlease input rate of pay: ");
        rateofPayStr = Console.ReadLine();
        rateofPay = Convert.ToDouble(rateofPayStr);

        Employee newEmployee = new Employee(double hrsWorked, double rate);
        newEmployee.CalcGrossPay();
        newEmployee.CalcStateTax();
        newEmployee.CalcFedTax();
        newEmployee.CalcFicaTax();
        newEmployee.CalcNetPay();

        SC.WriteLine("\nEnd of Lab 18\n");
    }
} // end of "Lab18" class

class Employee
{
    private double hoursWorked, rateofPay, grossPay, stateTax, fedTax, ficaTax, netPay;

    // Constructor method
    public Employee(double hrsWorked, double rate)
    {
        hoursWorked = hrsWorked;
        rateofPay = rate;
    }

    // Gross pay method
    public void CalcGrossPay()
    {
        grossPay = hoursWorked * rateofPay;
        SC.WriteLine("\nGross pay is:\t{0,10}", grossPay.ToString("C"));
    }

    // State tax method
    public void CalcStateTax()
    {
        const double stateTaxRate = .04;
        stateTax = grossPay * stateTaxRate;
        SC.WriteLine("\nState tax is:\t{0,10}", stateTax.ToString("C"));
    }

    // Federal tax method
    public void CalcFedTax()
    {
        const double fedTaxRate = .23;
        fedTax = grossPay * fedTaxRate;

        SC.WriteLine("\nFederal tax is:\t{0,10}", fedTax.ToString("C"));
    }

    // FICA tax method
    public void CalcFicaTax()
    {
        const double ficaTaxRate = .14;
        fedTax = grossPay * ficaTaxRate;

        SC.WriteLine("\nFICA tax is:\t{0,10}", grossPay.ToString("C"));
    }

    //Net pay method
    public void CalcNetPay()
    {
        netPay = grossPay - (stateTax + fedTax + ficaTax);
        SC.WriteLine("\nNet pay is:\t{0,10}", netPay.ToString("C"));

    }
}

Line 21: When you call a method, you don't provide the types with the method. Remove the two 'double'.
Line 21: rate is not a variable in your method, did you mean rateofPay?

Dang Momerath you beat me to it.

Actually the problem is "I am never taking a C# class again."

LOL just kidding, I love C#, and if I have the choice it's the language I always choose ... don't give up on it, it's a very nice language (it literally can do almost anything you can think of).

Plus there's the MSDN website that makes coding in C# extremely easy (as well as Daniweb to help)

In addition to Ange1's comments the following may be of interest, the web tutorials show everything.

Thank you all. In my haste, I overlooked calls do not contain the varible type.

As for never taking C# again, I don't think it's a language I can keep up with due dates on. If I continue, it will be in my free time.

Thank you all again.

Well, please don't ditch it. When it comes to programming, I probably write code more efficient and quicker in C# (because of all the stuff it can do, and the community on the web include MSDN).

LOL best method Convert.To_______ (When I took my C++ class ... I had to scavenger the web to find all the different type of converters).

Plus don't forget you got the DaniWeb community who has countless times helped me with C# questions (that or the web, I think I've only been stumpted once by a piece of C# code). I mean I consider myself an amateur compared to the guys above me ... but I am more then willing to help you with C#

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.