Thread: Timecard Challange

  1. #1
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681

    Timecard Challange

    Not trying to take over Prelude's glory here but we haven't had anything for a while.

    So here goes. The basic purpose is to create a program that gets the start and end times for a person's work day and calculate how much time they worked.

    Newbie
    To Do: Get the start and end times from the user and calculate the hours worked per day. Then calculate the total time worked for one week. Print a summery screen, such as "Day 1 worked X hrs..."
    To assume: The user begins and ends their shift on the same day. The user will be entering the hours in 24 hour format.

    Novice
    To Do: Same as newbie, however calculate the amount of regular time and amount of overtime.
    To assume: The work day is 8 hours, any time over this is overtime. The work week is 40 hours, any time over this is overtime. (Note if a person works overtime on a single day but falls below 40 hrs for the week they still get the overtime)

    Intermidate
    To Do: Same as novice, however get the time format from the user beforehand. Ie ask if they want to enter the hrs in 24 or 12 mode.

    Intermidate +
    To Do: Same as Intermidate but do not assume that the begin and end times will be on the same day (think graveyard shift)
    To assume: No 24 hour shifts

    Intermidate ++
    To Do: Same as Intermidate +, but find out from the user when overtime begins. (Some people work 10 or 12 hr shifts on normal time)

    Advanced
    To Do: Same as Intermidate ++. Also Get the full time from the user and from format determine if 12 or 24 hr time.
    To assume: 12 hr time will be inputted as "hh:mm", 24 hr time will be inputted as "hhmm".

    Advanced +
    To Do: Same as Advanced but also calculate double overtime. Have to ask user when double time begins. Also deal with the user not having an overtime period. (Example: my sister in law is a nurse, she works 12 hr shifts. After 12 hrs she goes into double time, with no overtime period)


    Post source code here. This is more of an exercise then it is a challange so I won't be looking for the "winner." If Prelude or one of the mods want to judge thats fine.

    Note: Just in case you are wondering: NO! This isn't a school assignment. Not even in a C class This is purely for fun.

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    That's not a time clock. A time clock simply takes a users name/id and then clocks them in or out accordingly. What you are proposing is a subunit of that functionality - a time editor.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  3. #3
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    who said anything about a timeclock? I said timecard. And on my time card I have to enter the time I started, time I ended, and length of lunch (and unpay time). Also have to enter the amount of time in regular, ot, and double time.

    And damn I forgot to add in factoring in upay (ie lunch) time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A challange
    By Ahmed29 in forum C++ Programming
    Replies: 39
    Last Post: 11-03-2008, 09:25 PM
  2. Challange for Cprogramming.com
    By umar7001 in forum C++ Programming
    Replies: 28
    Last Post: 04-15-2007, 08:31 AM
  3. Stuck on a friend's challange
    By wiresite in forum C++ Programming
    Replies: 32
    Last Post: 04-23-2004, 07:36 AM
  4. Chess Challange
    By kosmoludek in forum C Programming
    Replies: 4
    Last Post: 01-12-2003, 04:53 PM
  5. Console base timecard system
    By C-Dumbie in forum C Programming
    Replies: 7
    Last Post: 10-02-2002, 08:55 PM