Results 1 to 2 of 2
  1. #1
    MrPosotive is offline Member
    Join Date
    Sep 2012
    Posts
    68
    Rep Power
    0

    Default How do i import a .dat file into java and isolate the numbers that are in the file?

    Hey guys just got this class assignment, here it is.... "Program 213a
    (weird wages)

    Program Description: You just started working as a programmer. You are paid $10 an hour, with a few exceptions. You earn an extra $1.50 an hour for any part of a day where you work more than 8 hours, and an extra $2.50 an hour for hours beyond 40 in any one week. You also earn a 125% bonus for working on Saturday, and a 50% bonus for working on Sunday. The bonuses for Saturday and Sunday are computed based on the hours worked those days; they are not used to calculate any bonus for working more than 40 hours in a week.

    Your input file will be the number of hours you worked each day in the week beginning with Sunday. You need to write a program that will continue processing the file to calculate your gross pay for each week worked until the end of file is reached. Each line of input will consist of one weeks hours (7 integers per line, each less than or equal to 24). Ouput the gross pay with a dollar sign rounded to the nearest penny for each week worked.

    Statements Required: loops, decision making

    Data Location: prog213a.dat

    Sample Output:

    Hours Worked: 9 8 10 8 9 9 5
    Week # 1 $703.50

    Hours Worked: 7 8 8 8 0 8 9
    Week # 2 $627.50

    Hours Worked: 6 10 5 0 0 0 0
    Week # 3 $243.00

    Hours Worked: End of reading from file."

    Can some one tell me how to import files in java. Or how to isolate the numbers in the file? Either one to get me started, please and thank you.

  2. #2
    Jingoism is offline Member
    Join Date
    Nov 2012
    Posts
    14
    Rep Power
    0

    Default Re: How do i import a .dat file into java and isolate the numbers that are in the fil

    Well *.dat files are usually just a generic term for any number of formats... so what exactly is in the file? If it is plain text then you can just fire up the FileIO and start looking for patterns to parse on.

    http://docs.oracle.com/javase/tutorial/essential/io/
    Last edited by Jingoism; 11-20-2012 at 05:50 AM.

Similar Threads

  1. To import CSV file into java for Plotting graph.
    By Niisha in forum Advanced Java
    Replies: 0
    Last Post: 03-25-2012, 06:31 PM
  2. Import a folder of *java file
    By hqt in forum Eclipse
    Replies: 1
    Last Post: 02-08-2012, 11:58 AM
  3. Replies: 0
    Last Post: 04-02-2011, 11:22 AM
  4. how to import xfdf file into the pdf file
    By jkrishnanvenkat in forum New To Java
    Replies: 3
    Last Post: 11-09-2009, 03:46 AM
  5. how to import a ejb bean in java file
    By vijayinani in forum Enterprise JavaBeans (EJB)
    Replies: 2
    Last Post: 06-30-2009, 11:05 PM

Posting Permissions

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