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
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
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.
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.