Thread: Can someone help please :)

  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    1

    Can someone help please :)

    Create a program that will compute the monthly Net Pay of an employee. The user will type the no. of hours worked and the hourly rate of the employee. The program will deduct 3% for SSS, 11%for tax and P25.00 for health insurance display the gross pay, individual deduction and the weekly net pay of the employee */

    Given:
    float hours_worked,rate,sss,tax,health,gpay,npay;


    I really gets confused most of the time.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    What have you tried?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Sounds simple enough....
    Just set yourself down with a pencil, paper and nice hot coffee and work it out step by step...
    Become the process... what do you need to do first? Then what next? until you've got it sorted.
    Then once you understand the problem you can start sorting out the C code for it.
    Once you're confident you have a solution, take half an hour off and then...
    Are you ready...???
    Start writing code.

    Yep... writing code is always the second last thing a programmer does.

    As I'm want to say... There is no programmer on earth who can code a solution to a problem he doesn't understand.

  4. #4
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by CommonTater View Post
    Sounds simple enough....
    Just set yourself down with a pencil, paper and nice hot coffee and work it out step by step...
    Become the process... what do you need to do first? Then what next? until you've got it sorted.
    Then once you understand the problem you can start sorting out the C code for it.
    Once you're confident you have a solution, take half an hour off and then...
    Are you ready...???
    Start writing code.

    Yep... writing code is always the second last thing a programmer does.

    As I'm want to say... There is no programmer on earth who can code a solution to a problem he doesn't understand.
    Yes, the last thing a programmer does is to use the most used key in programming: delete.

    Then he starts over again, until he gets it right.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  5. #5
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by claudiu View Post
    Yes, the last thing a programmer does is to use the most used key in programming: delete.

    Then he starts over again, until he gets it right.
    LOL... Yours is better than mine... I was thinking the last thing would be: "Fixing their own f___ ups".

  6. #6
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Quote Originally Posted by CommonTater View Post
    As I'm want to say... There is no programmer on earth who can code a solution to a problem he doesn't understand.
    But if you put enough monkeys in front of enough keyboards, you might just have a chance...

Popular pages Recent additions subscribe to a feed