CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2014
    Posts
    1

    Novice, Need some help.

    I am creating a simple overtime calculator with if then statements. I am missing something and I am sure it is simple. Here is the code snippet.

    string str_hours = txtHours.Text;
    double hours = Convert.ToDouble(str_hours);
    string str_payrate = txtPayRate.Text;
    double payrate = Convert.ToDouble(str_payrate);
    string str_paycheck = txtPaycheck.Text;
    double paycheck = Convert.ToDouble(str_paycheck);

    if (hours <= 40)

    paycheck=hours * 40;

    else

    paycheck=40 * payrate + (hours - 40) * 1.5;


    txtPaycheck.Text = str_paycheck;

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Novice, Need some help.

    What's the problem?

  3. #3
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Novice, Need some help.

    You're using str_paycheck

    and then something different

    Post the exact problem, though
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured