Results 1 to 5 of 5
  1. #1
    arshesander is offline Member
    Join Date
    Aug 2009
    Posts
    8
    Rep Power
    0

    Default computing hour & Salary

    Java Code:
    			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    			String data = timein,timeout;
    
    			System.out.println("Enter the time-in: ");
    			timein = br.readLine();
    			System.out.println("Enter the time-out: ");
    i have tried the code above to enter time in/out..
    but my problem is how to compute the time (timeout-timeout) and automatically it will display the salary of the employee?

    e.g.
    Time In : 8:00
    Time Out : 17:00
    DailyRate : 350

    The display should be like this:
    No. of Hours : 8 hrs
    Salary : 350


    this scenario, sometimes the employee has late, so that if the no of hours is incomplete.. his salary for that day is based on his hour of work..

    hope you get my point pls..

    thanks in advance..

  2. #2
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    look into DateFormat class. But the easy way is to use String.split(":") then call Integer.parseInt() on each value in the array.
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  3. #3
    arshesander is offline Member
    Join Date
    Aug 2009
    Posts
    8
    Rep Power
    0

    Default

    oh i see? kindly give me sample sir.. i really dont have any idea regarding java..

  4. #4
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    don't need sample, thats too trivial. Give it a try first.
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  5. #5
    emceenugget is offline Senior Member
    Join Date
    Sep 2008
    Posts
    564
    Rep Power
    6

    Default

    i second using split. using any kind of date/time representation is a bit too much for this

Similar Threads

  1. HELP!! Assignment due in one hour!
    By murr0508 in forum New To Java
    Replies: 1
    Last Post: 02-26-2009, 09:31 PM
  2. Computing the sum
    By Limuh in forum New To Java
    Replies: 3
    Last Post: 08-13-2008, 06:00 AM
  3. [SOLVED] Very Simple 2-3 hour project $50
    By arbit3r in forum Jobs Offered
    Replies: 3
    Last Post: 08-05-2008, 03:20 AM
  4. weekly salary
    By dollakay in forum New To Java
    Replies: 2
    Last Post: 05-09-2008, 02:46 PM
  5. Calculating per hour statistics
    By vipergt89 in forum New To Java
    Replies: 2
    Last Post: 05-01-2008, 06:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •