Thread: hows life fine i guess.Well i have a problem again

  1. #1
    Registered User datainjector's Avatar
    Join Date
    Mar 2002
    Posts
    356

    Talking hows life fine i guess.Well i have a problem again

    Since i have started programming in C its been hell for me

    3.21 Develop a program that will determine the gross pay for each employees.The company pays "staight-right" for the first 40 hours worked by each employee and pays " time and a half" for all hours worked in excess of 40 hours.


    Enter # of hours worked( -1 to end): 39
    Enter hourly rate of the worker ($00.00):10.00
    Salary is $390.00

    Enter # of hours worked( -1 to end): 40
    Enter hourly rate of the worker ($00.00):10.00
    Salary is $400.00

    Enter # of hours worked( -1 to end): 41
    Enter hourly rate of the worker ($00.00):10.00
    Salary is $415.00


    What do they mean by time-and-a-half???
    is it 1.5 times their houly wages???

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Yep. Time and a half is 150% of your normal pay. Likewise, 'double time' and 'double time and a half' ...

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Unregistered
    Guest
    This is simple stuff here...Here's the pseudocode:
    for each employee,
    1) read in the number of hours worked,
    2) read in the hourly wage
    3) check if number of hours worked > 40 (or whenever overtime starts paying) and then if it is, return the product of hours * wage *1.5
    else, return #ofHours * wage

    That's it, or at least it seems like it based on your problem spec.

  4. #4
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    3) check if number of hours worked > 40 (or whenever overtime starts paying) and then if it is, return the product of hours * wage *1.5
    else, return #ofHours * wage
    I spent quite a few minutes rereading this, and this could be very misleading.

    Lets say I make $12 an hour.
    Lets say I worked 50 hours.

    $12 * 40 = NormalPay
    $12 * 10 * 1.5 = Overtime
    Overtime + NormalPay = Gross
    Gross * .75 - .60 (whatever you get taxed) - irrelevant

    > What do they mean by time-and-a-half??? is it 1.5 times their houly wages???
    Yes.

    You don't need to figure out taxes, so that should be an easy piece of code.
    The world is waiting. I must leave you now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 12-03-2003, 05:47 PM
  2. Half life Problem which I am right and the teacher is wrong
    By Shadow12345 in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 11-06-2002, 04:28 PM
  3. Half Life Blue Shift Problem
    By biosninja in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 08-23-2002, 09:57 AM
  4. Random things are fine, just one problem with them.
    By DarkSFK in forum C++ Programming
    Replies: 14
    Last Post: 08-19-2002, 08:40 AM
  5. problem with output
    By Garfield in forum C Programming
    Replies: 2
    Last Post: 11-18-2001, 08:34 PM