Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8957747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:03:42+00:00 2026-06-15T15:03:42+00:00

This method is part of a larger program that pulls employee data from a

  • 0

This method is part of a larger program that pulls employee data from a .txt file and then uses that data to calculate net pay.
My CalcPay method is supposed to figure pay for hours > 40 as well as hours < 40, but when it gets to the employees with more than 40 hours, it figures their pay at just hours * wage as opposed to taking hours > 40 and making them time-and-a-half…any suggestions?

public double CalcPay()
    {

        double pay = hoursWorked * hourlyWage;
        double overTimeHours = hoursWorked - FULL_TIME;

        if (overTimeHours > 0)
        {
            pay += overTimeHours * (hourlyWage * OVER_TIME_RATE);
        }
        double tax1 = pay * FED_TAX;
        double tax2 = pay * STATE_TAX;
        return ((pay - tax1) - tax2);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:03:44+00:00Added an answer on June 15, 2026 at 3:03 pm

    I’d probably do something like this.

     public double CalcPay()
        {
            double regularHours = Math.Min(hoursWorked, FULL_TIME);
            double overTimehours = Math.Max(hoursWorked - FULL_TIME, 0);
    
            double regularPay = regularHours * hourlyWage;
            double overTimePay = overTimehours * hourlyWage * OVER_TIME_RATE;
            double pay = regularPay + overTimePay;
    
            double tax1 = pay * FED_TAX;
            double tax2 = pay * STATE_TAX;
            return ((pay - tax1) - tax2);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this method as part of a larger class. I'm trying to write
As part of a larger program, I have a method which computes the coefficients
I'd like to remove all unchecked warnings from this general utility method (part of
I have a web method like this as part of a web service public
I added this part of the code in my onCreate() method and it crashes
my problem is the following: This is a part of my HTML-Code: <form method='GET'
This method that draws my tiles seems to be quite slow, Im not sure
This is my javascript method in .aspx file. I want to invoke this method
I wrote a binary search function as part of a larger program, but it
I am attempting to bind a list that is part of a larger view

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.