Options

C# question

nelnel Member Posts: 2,859 ■□□□□□□□□□
im trying to write a example program which calculates an employees wage. basically they input the hrs worked and the users pay rate. the output calculates the wage but i need it so that if the employee works over 40 hrs then any hours ov over the 40 mark are paid at double rate.

i cant seem to figure it out(im new to this programming stuff!)

could anyone help?
Xbox Live: Bring It On

Bsc (hons) Network Computing - 1st Class
WIP: Msc advanced networking

Comments

  • Options
    dtlokeedtlokee Member Posts: 2,378 ■■■■□□□□□□
    float hours, wage, rate;

    if (hours > 40)
    {
    wage = ((hours - 40) * (rate * 2) + (40 * rate);
    }
    else
    {
    wage = hours * rate;
    }

    or somthing like that.
    The only easy day was yesterday!
  • Options
    nelnel Member Posts: 2,859 ■□□□□□□□□□
    thanks mate your a star, i was so close but didnt have my maths in the right places
    Xbox Live: Bring It On

    Bsc (hons) Network Computing - 1st Class
    WIP: Msc advanced networking
  • Options
    dtlokeedtlokee Member Posts: 2,378 ■■■■□□□□□□
    I have been drinking heavily today, you may end up overpaying your employes icon_wink.gif
    The only easy day was yesterday!
  • Options
    nelnel Member Posts: 2,859 ■□□□□□□□□□
    haha ....if only that would happen to all of us icon_lol.gif
    Xbox Live: Bring It On

    Bsc (hons) Network Computing - 1st Class
    WIP: Msc advanced networking
Sign In or Register to comment.