Thread: Challenge 1

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    7

    Challenge 1

    Write a program that reads in the name, hourly rate and number of hours worked for 5 people. Print the name of each person, the number of hours worked, their weekly pay based on the number of hours they worked and how much they owe in taxes. Assume that taxes take 20% of the paycheck. Don’t forget to take the taxes out of the pay check. If they work more than 40 hours they get overtime. The hourly rate is then 1.5 times normal for all hours past 40.

    Example (Sample input & output for one person)
    Enter name: Glenn
    Enter hourly rate: 4.00
    Enter hours worked: 75

    Pay to: Glenn
    Hourly rate: 4.00
    Hours worked: 75.0
    Amount paid: $370.00
    Taxes paid: $74.00

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    And this is? We wont write your entire code for you. Start and come back when you run into a specific problem. If you need help with how to start, well there are tutorials on the web (C programming.com - Your Resource for C and C++ Programming) for instance.

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    I prefer my challenges a bit more... challenging...

    And damn, 20% taxes? What country is that - I got to move there. Stupid >50% taxes here...

  4. #4
    Registered User
    Join Date
    Jan 2009
    Posts
    1,485
    Aah, I see you are trying to fool us all into take on your challenge, and thereby doing your homework.

  5. #5
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Will you stop posting a hundred threads for the same thing already???
    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.

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Programming Challenge (for my school)
    By Ezerhorden in forum C++ Programming
    Replies: 2
    Last Post: 01-04-2006, 06:56 AM
  2. Challenge
    By arjunajay in forum C++ Programming
    Replies: 8
    Last Post: 08-20-2005, 02:13 AM
  3. Requesting a challenge
    By RealityFusion in forum C++ Programming
    Replies: 8
    Last Post: 08-18-2003, 08:24 PM
  4. Speed Challenge, my solution:
    By RoD in forum C++ Programming
    Replies: 11
    Last Post: 03-17-2003, 09:12 PM
  5. C++ Code - A simple challenge
    By euphoric in forum C++ Programming
    Replies: 5
    Last Post: 11-02-2002, 05:35 PM